File: 4DOM.web

package info (click to toggle)
qm 1.1.3-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,628 kB
  • ctags: 10,249
  • sloc: python: 41,482; ansic: 20,611; xml: 12,837; sh: 485; makefile: 226
file content (245 lines) | stat: -rw-r--r-- 9,148 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?xml version="1.0"?>
<?xml-stylesheet href="http://xslt.fourthought.com/web.xslt" type="text/xsl"?>
<spec:package
  xmlns="http://docbook.org/docbook/xml/4.0/namespace"
  xmlns:spec="http://namespaces.fourthought.com/specification"
>

<spec:header>
  <spec:name>4DOM</spec:name>
  <spec:desc>Standards-Based XML and HTML manipulation using Python</spec:desc>
  <spec:author>Fourthought, Inc.</spec:author>
  <spec:homepage>http://4Suite.org</spec:homepage>
</spec:header>

<!-- News -->

<spec:event>
  <spec:date>2000-11-01</spec:date>
  <spec:desc>4Suite 0.9.2 released.</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-10-11</spec:date>
  <spec:desc>4Suite 0.9.1 released.</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-09-20</spec:date>
  <spec:desc>4Suite 0.9.0 released.  4DOM is now bundled therein</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-07-24</spec:date>
  <spec:desc>4DOM 0.10.2 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-06-06</spec:date>
  <spec:desc>4DOM 0.10.1 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-05-24</spec:date>
  <spec:desc>4DOM 0.10.0 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-03-16</spec:date>
  <spec:desc>4DOM 0.9.3 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-01-25</spec:date>
  <spec:desc>4DOM 0.9.2 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>2000-01-03</spec:date>
  <spec:desc>4DOM 0.9.1 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1999-12-19</spec:date>
  <spec:desc>4DOM 0.9.0 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1999-10-21</spec:date>
  <spec:desc>4DOM 0.8.2 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1999-09-14</spec:date>
  <spec:desc>4DOM 0.8.1 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1999-08-31</spec:date>
  <spec:desc>4DOM 0.8.0 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1999-02-07</spec:date>
  <spec:desc>4DOM 0.7.0 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1998-11-20</spec:date>
  <spec:desc>4DOM 0.6.1 released</spec:desc>
</spec:event>

<spec:event>
  <spec:date>1998-11-04</spec:date>
  <spec:desc>4DOM 0.6.0 released</spec:desc>
</spec:event>

<!-- Overview -->

<spec:overview>
<para>
  4DOM is a <link linkend="http://www.python.org">Python</link> implementation of the <link linkend="http://www.w3.org/TR/DOM-Level-2/">document object model (DOM)</link>, a standard interface for manipulating XML and HTML documents developed by the World-Wide Web Consortium.  4DOM implements DOM Level 2 Core, Level 2 HTML and Document Traversal, and a few extensions.
</para>

<para>
  4DOM is designed to allow developers rapidly design applications that read, write or manipulate HTML and XML.
</para>

<para>
  The current version is bundled with 4Suite <spec:version/>. See the <link linkend="../ChangeLog">ChangeLog</link> for notes on the current version.
</para>
</spec:overview>

<!-- Installation -->

<spec:install>
  <para>
    Download <link linkend="ftp://4Suite.org/download.epy">4Suite</link> install one of the binary packages.  Alternatively, you can download the source instead and install using Python distutils as follows:
  </para>
  <screen>python setup.py install</screen>
  <para>
    See <link linkend="../PACKAGES.html">PACKAGES</link> for more information about the available 4Suite packages.  Be sure to check the <link linkend="../README.html">README</link> in the 4Suite package for more details.
  </para>
</spec:install>

<!-- Directory Structure -->

<spec:structure>
  <spec:path>xml/dom</spec:path>
  <spec:desc>Core DOM components (including XML classes)</spec:desc>
</spec:structure>

<spec:structure>
  <spec:path>xml/dom/html</spec:path>
  <spec:desc>HTML components</spec:desc>
</spec:structure>

<spec:structure>
  <spec:path>xml/dom/ext</spec:path>
  <spec:desc>Extensions and proprietary components</spec:desc>
</spec:structure>

<spec:structure>
  <spec:path>xml/dom/docs</spec:path>
  <spec:desc>(currently minimal) documentation</spec:desc>
</spec:structure>

<spec:structure>
  <spec:path><emphasis>DOCUMENTATION_PATH</emphasis>/4Suite/4DOM/demo</spec:path>
  <spec:desc>Small scripts demonstrating some uses of 4DOM.  See the README in this directory.</spec:desc>
</spec:structure>

<spec:structure>
  <spec:path><emphasis>DOCUMENTATION_PATH</emphasis>/4Suite/4DOM/test_suite</spec:path>
  <spec:desc>Test scripts.</spec:desc>
</spec:structure>

<!-- Implementation Notes -->

<spec:note>
  <spec:title>Accessors/Mutators for Attributes</spec:title>
  <para>
    Following discussion on the Python XML SIG mailing list, 4DOM provides two ways to access DOM interface attributes.  As an example, the DOM IDL definition for the Node interface contains <computeroutput>readonly attribute DOMString childNodes</computeroutput>.  This can be accessed as a simple Python attribute: <computeroutput>node.childNodes</computeroutput>, or as a method call using the Python/CORBA mapping for attributes: <computeroutput>node._get_childNodes()</computeroutput> [if childNodes were a read/write attribute, there would also be a <computeroutput>node._set_childNodes()</computeroutput>].  There is a slight speed advantage to using the latter convention.
  </para>
</spec:note>

<spec:note>
  <spec:title>Document._get_ownerDocument()</spec:title>
  <para>Document._get_ownerDocument() returns a pointer to itself.</para>
</spec:note>

<spec:note>
  <spec:title>Creating HTML Element Nodes</spec:title>
  <para>
    HTMLDocument.createElement() overrides the Document.CreateElement() method, looking up the specified tag and returning an instance of the propriate HTML node.  For instance:
    <screen>
      # html_doc is an instance of HTMLDocument
      table_elem = html_doc.createElement("TABLE")
      # table_elem is an instance of HTMLTableElement
    </screen>
  </para>
</spec:note>

<!-- Deviations from the specification -->

<spec:deviation>
  4DOM does not implement DOMString. Instead, the interfaces use a plain Python string instead. Note that Python strings do not have length limitations, and unicode is still in beta.
</spec:deviation>

<spec:deviation>
  The DOM Spec section on the removeAttribute method of the Element interface has some rules for Attribute removal with respect to default values. 4DOM only follows these rules if you remove attributes using the removeAttribute method, and the default attribute will not be properly set if you use removeNamedItem to remove an attribute from the NamedNodeMap returned by Element.getAttributes.
</spec:deviation>

<spec:deviation>
  The DOM ambiguously specifies that if the given name in the removeNamedItem method of NamedNodeMap not found, None is returned <emphasis>and</emphasis> an exception is raised. This isn't possible in most languages. 4DOM chooses to return None.
</spec:deviation>

<spec:deviation>
  4DOM does not implement HTMLElement features strictly for browser environment, for example, blur and focus properties of HTMLSelectElement.
</spec:deviation>

<spec:deviation>
  Some methods of the DOM spec for HTML do not allow for errors associated with missing nodes. So, for example, HTMLDocument::setTitle() does not allow for the return of an error if the HTMLDocument does not have an HTMLHeadElement child. 4DOM, in these cases, will automatically add in needed elements in order to strictly follow the DOM interface spec.  The methods for which 4DOM provides automatic document completion are:
  <simplelist>
    <member>
      <computeroutput>HTMLDocument::getDocumentElement()</computeroutput>
    </member>
    <member>
      <computeroutput>HTMLDocument::setTitle()</computeroutput>
    </member>
    <member>
      <computeroutput>HTMLDocument::getBody()</computeroutput>
    </member>
    <member>
      <computeroutput>HTMLDocument::setBody()</computeroutput>
    </member>
    <member>
      <computeroutput>HTMLTableElement::insertRow()</computeroutput>
    </member>
    <member>
      <computeroutput>HTMLTableRowElement::insertCell()</computeroutput>
    </member>
  </simplelist>
</spec:deviation>

<spec:deviation>
  See <link linkend="Extensions.html">4DOM Extensions</link> for documentation of proprietary extensions and helper functions provided by 4DOM.
</spec:deviation>

<!-- More Information -->

<spec:etc>
<para>
  For release notes and news, see <link linkend="http://4Suite.org/index.epy">http://4Suite.org</link>
</para>

<para>
  The 4Suite users and support mailing list can be subscribed to, and archives viewed at <link linkend='http://lists.fourthought.com/mailman/listinfo/4suite'>http://lists.fourthought.com/mailman/listinfo/4suite</link>
</para>

<para>
  4Suite developers monitor the above list, and prefer for support to come thereby, but you can also contact them directly at <link linkend="mailto:support@4suite.org">support@4suite.org</link> with questions and comments. You might also post messages to or check the archives of the Python <link linkend="http://www.python.org/sigs/xml-sig/">xml-sig</link> mailing list.
</para>
</spec:etc>

</spec:package>