1 /*
2 * Copyright (C) 2002 Carsten Krebs (Team-Konzept GmbH & Co.KG)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 package com.teamkonzept.dom4jb.dom;
19
20 import java.util.LinkedList;
21
22
23 import com.teamkonzept.dom4jb.schema.AttributeDescriptor;
24 import com.teamkonzept.dom4jb.schema.CDATADescriptor;
25 import com.teamkonzept.dom4jb.schema.ElementDescriptor;
26 import com.teamkonzept.dom4jb.schema.TextDescriptor;
27
28 public class Document extends Node
29 implements org.w3c.dom.Document {
30
31 public Node adoptNode( final Node node) {
32 throw new UnsupportedOperationException(
33 "Method adoptNode( Node ) "
34 + "not yet implemented."
35 );
36 }
37
38 /*** Creates new Document */
39 public Document() {
40 super( null, null );
41 }
42
43 /***
44 * Adds the node <code>newChild</code> to the end of the list of children
45 * of this node. If the <code>newChild</code> is already in the tree, it
46 * is first removed.
47 * @param newChild The node to add.If it is a
48 * <code>DocumentFragment</code> object, the entire contents of the
49 * document fragment are moved into the child list of this node
50 * @return The node added.
51 */
52 public org.w3c.dom.Node appendChild( final org.w3c.dom.Node newChild ) {
53 /***
54 * %TODO% * zulassen mehrerer Kinder
55 * * Exception werfen, falls Node nicht zum selbel Dokument gehört.
56 */
57 clear();
58 final Node node = (Node)newChild;
59 node.setParentNode( this );
60 add( node );
61 return (org.w3c.dom.Element)node;
62 }
63
64 public final org.w3c.dom.Node getParentNode() {
65 return null;
66 }
67
68 /***
69 * A <code>NodeList</code> that contains all children of this node. If
70 * there are no children, this is a <code>NodeList</code> containing no
71 * nodes.
72 */
73 public org.w3c.dom.NodeList getChildNodes() {
74 return this;
75 }
76
77 public org.w3c.dom.Node getFirstChild() {
78 return getChildNodes().item(0);
79 }
80
81 public org.w3c.dom.Node getLastChild() {
82 return getChildNodes().item( getLength()-1 );
83 }
84
85 public boolean hasChildNodes() {
86 return getFirstChild() != null;
87 }
88
89 /***
90 * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
91 * given local name and namespace URI in the order in which they are
92 * encountered in a preorder traversal of the <code>Document</code> tree.
93 * @param namespaceURI The namespace URI of the elements to match on. The
94 * special value "*" matches all namespaces.
95 * @param localName The local name of the elements to match on. The
96 * special value "*" matches all local names.
97 * @return A new <code>NodeList</code> object containing all the matched
98 * <code>Elements</code>.
99 * @since DOM Level 2
100 */
101 public org.w3c.dom.NodeList getElementsByTagNameNS(final String namespaceURI,
102 final String localName) {
103 throw new UnsupportedOperationException(
104 "Method getElementsByTagNameNS() "
105 + "not yet implemented."
106 );
107 }
108
109 /***
110 * The name of this node, depending on its type; see the table above.
111 */
112 public final String getNodeName() {
113 return "#document";
114 }
115
116 /***
117 * Creates an empty <code>DocumentFragment</code> object.
118 * @return A new <code>DocumentFragment</code>.
119 */
120 public org.w3c.dom.DocumentFragment createDocumentFragment() {
121 throw new UnsupportedOperationException(
122 "Method getElementsByTagNameNS() "
123 + "not yet implemented."
124 );
125 }
126
127 /***
128 * Imports a node from another document to this document. The returned
129 * node has no parent; (<code>parentNode</code> is <code>null</code>).
130 * The source node is not altered or removed from the original document;
131 * this method creates a new copy of the source node.
132 * <br>For all nodes, importing a node creates a node object owned by the
133 * importing document, with attribute values identical to the source
134 * node's <code>nodeName</code> and <code>nodeType</code>, plus the
135 * attributes related to namespaces (<code>prefix</code>,
136 * <code>localName</code>, and <code>namespaceURI</code>). As in the
137 * <code>cloneNode</code> operation on a <code>Node</code>, the source
138 * node is not altered.
139 * <br>Additional information is copied as appropriate to the
140 * <code>nodeType</code>, attempting to mirror the behavior expected if
141 * a fragment of XML or HTML source was copied from one document to
142 * another, recognizing that the two documents may have different DTDs
143 * in the XML case. The following list describes the specifics for each
144 * type of node.
145 * <dl>
146 * <dt>ATTRIBUTE_NODE</dt>
147 * <dd>The <code>ownerElement</code> attribute
148 * is set to <code>null</code> and the <code>specified</code> flag is
149 * set to <code>true</code> on the generated <code>Attr</code>. The
150 * descendants of the source <code>Attr</code> are recursively imported
151 * and the resulting nodes reassembled to form the corresponding subtree.
152 * Note that the <code>deep</code> parameter has no effect on
153 * <code>Attr</code> nodes; they always carry their children with them
154 * when imported.</dd>
155 * <dt>DOCUMENT_FRAGMENT_NODE</dt>
156 * <dd>If the <code>deep</code> option
157 * was set to <code>true</code>, the descendants of the source element
158 * are recursively imported and the resulting nodes reassembled to form
159 * the corresponding subtree. Otherwise, this simply generates an empty
160 * <code>DocumentFragment</code>.</dd>
161 * <dt>DOCUMENT_NODE</dt>
162 * <dd><code>Document</code>
163 * nodes cannot be imported.</dd>
164 * <dt>DOCUMENT_TYPE_NODE</dt>
165 * <dd><code>org.w3c.dom.DocumentType</code>
166 * nodes cannot be imported.</dd>
167 * <dt>ELEMENT_NODE</dt>
168 * <dd>Specified attribute nodes of the
169 * source element are imported, and the generated <code>Attr</code>
170 * nodes are attached to the generated <code>Element</code>. Default
171 * attributes are not copied, though if the document being imported into
172 * defines default attributes for this element name, those are assigned.
173 * If the <code>importNode</code> <code>deep</code> parameter was set to
174 * <code>true</code>, the descendants of the source element are
175 * recursively imported and the resulting nodes reassembled to form the
176 * corresponding subtree.</dd>
177 * <dt>ENTITY_NODE</dt>
178 * <dd><code>Entity</code> nodes can be
179 * imported, however in the current release of the DOM the
180 * <code>org.w3c.dom.DocumentType</code> is readonly. Ability to add these
181 * imported nodes to a <code>org.w3c.dom.DocumentType</code> will be
182 * considered for addition to a future release of the DOM.On import, the
183 * <code>publicId</code>, <code>systemId</code>, and
184 * <code>notationName</code> attributes are copied. If a <code>deep</code>
185 * import is requested, the descendants
186 * of the the source <code>Entity</code> are recursively imported and
187 * the resulting nodes reassembled to form the corresponding subtree.</dd>
188 * <dt>
189 * ENTITY_REFERENCE_NODE</dt>
190 * <dd>Only the <code>EntityReference</code> itself is
191 * copied, even if a <code>deep</code> import is requested, since the
192 * source and destination documents might have defined the entity
193 * differently. If the document being imported into provides a
194 * definition for this entity name, its value is assigned.</dd>
195 * <dt>NOTATION_NODE</dt>
196 * <dd>
197 * <code>Notation</code> nodes can be imported, however in the current
198 * release of the DOM the <code>org.w3c.dom.DocumentType</code> is readonly.
199 * Ability to add these imported nodes to a
200 * <code>org.w3c.dom.DocumentType</code> will be
201 * considered for addition to a future release of the DOM.On import, the
202 * <code>publicId</code> and <code>systemId</code> attributes are copied.
203 * Note that the <code>deep</code> parameter has no effect on
204 * <code>Notation</code> nodes since they never have any children.</dd>
205 * <dt>
206 * PROCESSING_INSTRUCTION_NODE</dt>
207 * <dd>The imported node copies its
208 * <code>target</code> and <code>data</code> values from those of the
209 * source node.</dd>
210 * <dt>TEXT_NODE, CDATA_SECTION_NODE, org.w3c.dom.Comment_NODE</dt>
211 * <dd>These three
212 * types of nodes inheriting from <code>CharacterData</code> copy their
213 * <code>data</code> and <code>length</code> attributes from those of
214 * the source node.</dd>
215 * </dl>
216 * @param importedNode The node to import.
217 * @param deep If <code>true</code>, recursively import the subtree under
218 * the specified node; if <code>false</code>, import only the node
219 * itself, as explained above. This has no effect on <code>Attr</code>
220 * , <code>EntityReference</code>, and <code>Notation</code> nodes.
221 * @return The imported node that belongs to this <code>Document</code>.
222 * @since DOM Level 2
223 */
224 public org.w3c.dom.Node importNode( final org.w3c.dom.Node importedNode,
225 final boolean deep) {
226
227 throw new UnsupportedOperationException(
228 "Method importNode() "
229 + "not yet implemented."
230 );
231 }
232
233 /***
234 * The <code>DOMImplementation</code> object that handles this document. A
235 * DOM application may use objects from multiple implementations.
236 */
237 public org.w3c.dom.DOMImplementation getImplementation() {
238 return DOMImplementation.IMPLEMENTATION;
239 }
240
241 /***
242 * The namespace prefix of this node, or <code>null</code> if it is
243 * unspecified.
244 * <br>Note that setting this attribute, when permitted, changes the
245 * <code>nodeName</code> attribute, which holds the qualified name, as
246 * well as the <code>tagName</code> and <code>name</code> attributes of
247 * the <code>Element</code> and <code>Attr</code> interfaces, when
248 * applicable.
249 * <br>Note also that changing the prefix of an attribute that is known to
250 * have a default value, does not make a new attribute with the default
251 * value and the original prefix appear, since the
252 * <code>namespaceURI</code> and <code>localName</code> do not change.
253 * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
254 * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
255 * method, such as <code>createElement</code> from the
256 * <code>Document</code> interface, this is always <code>null</code>.
257 * @since DOM Level 2
258 */
259 public String getPrefix() {
260 throw new UnsupportedOperationException(
261 "Method getElementsByTagNameNS() "
262 + "not yet implemented."
263 );
264 }
265
266 /***
267 * The node immediately preceding this node. If there is no such node,
268 * this returns <code>null</code>.
269 */
270 public org.w3c.dom.Node getPreviousSibling() {
271 return null;
272 }
273
274 /***
275 * A code representing the type of the underlying object, as defined above.
276 */
277 public short getNodeType() {
278 return DOCUMENT_NODE;
279 }
280
281 /***
282 * The Document Type Declaration (see <code>org.w3c.dom.DocumentType</code>)
283 * associated with this document. For HTML documents as well as XML
284 * documents without a document type declaration this returns
285 * <code>null</code>. The DOM Level 2 does not support editing the
286 * Document Type Declaration. <code>docType</code> cannot be altered in
287 * any way, including through the use of methods inherited from the
288 * <code>Node</code> interface, such as <code>insertNode</code> or
289 * <code>removeNode</code>.
290 */
291 public org.w3c.dom.DocumentType getDoctype() {
292 return new DocumentType( this );
293 }
294
295 /***
296 * This is a convenience attribute that allows direct access to the child
297 * node that is the root element of the document. For HTML documents,
298 * this is the element with the tagName "HTML".
299 */
300 public org.w3c.dom.Element getDocumentElement() {
301 return (org.w3c.dom.Element)item(0);
302 }
303
304 public String getEncoding() {
305 return null;
306 }
307
308 public boolean getStandalone() {
309 return false;
310 }
311
312 public boolean getStrictErrorChecking() {
313 return false;
314 }
315
316 public String getVersion() {
317 return null;
318 }
319
320 public void setEncoding(String s) {
321 }
322
323 public void setStandalone(final boolean b) {
324 }
325
326 public void setStrictErrorChecking(final boolean b) {
327 }
328
329 public void setVersion(final String s) {
330 }
331
332 /***
333 * Creates an attribute of the given qualified name and namespace URI.
334 * @param namespaceURI The namespace URI of the attribute to create.
335 * @param qualifiedName The qualified name of the attribute to
336 * instantiate.
337 * @return A new <code>Attr</code> object with the following attributes:
338 * <table border='1'>
339 * <tr>
340 * <th>
341 * Attribute</th>
342 * <th>Value</th>
343 * </tr>
344 * <tr>
345 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
346 * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
347 * </tr>
348 * <tr>
349 * <td valign='top' rowspan='1' colspan='1'>
350 * <code>Node.namespaceURI</code></td>
351 * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
352 * </tr>
353 * <tr>
354 * <td valign='top' rowspan='1' colspan='1'>
355 * <code>Node.prefix</code></td>
356 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
357 * <code>qualifiedName</code>, or <code>null</code> if there is no
358 * prefix</td>
359 * </tr>
360 * <tr>
361 * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
362 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
363 * <code>qualifiedName</code></td>
364 * </tr>
365 * <tr>
366 * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
367 * <td valign='top' rowspan='1' colspan='1'>
368 * <code>qualifiedName</code></td>
369 * </tr>
370 * <tr>
371 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
372 * <td valign='top' rowspan='1' colspan='1'>the empty
373 * string</td>
374 * </tr>
375 * </table>
376 * @since DOM Level 2
377 */
378 public org.w3c.dom.Attr createAttributeNS(final String namespaceURI,
379 final String qualifiedName) {
380 throw new UnsupportedOperationException(
381 "Method createAttributeNS() "
382 + "not yet implemented."
383 );
384 }
385
386 /***
387 * The node immediately following this node. If there is no such node,
388 * this returns <code>null</code>.
389 */
390 public org.w3c.dom.Node getNextSibling() {
391 return null;
392 }
393
394 /***
395 * Creates a <code>org.w3c.dom.Comment</code> node given the specified string.
396 * @param data The data for the node.
397 * @return The new <code>org.w3c.dom.Comment</code> object.
398 */
399 public org.w3c.dom.Comment createComment(final String data) {
400 throw new UnsupportedOperationException(
401 "Method createComment() "
402 + "not yet implemented."
403 );
404 }
405
406 /***
407 * The namespace URI of this node, or <code>null</code> if it is
408 * unspecified.
409 * <br>This is not a computed value that is the result of a namespace
410 * lookup based on an examination of the namespace declarations in
411 * scope. It is merely the namespace URI given at creation time.
412 * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
413 * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
414 * method, such as <code>createElement</code> from the
415 * <code>Document</code> interface, this is always <code>null</code>.Per
416 * the Namespaces in XML Specification an attribute does not inherit
417 * its namespace from the element it is attached to. If an attribute is
418 * not explicitly given a namespace, it simply has no namespace.
419 * @since DOM Level 2
420 */
421 public String getNamespaceURI() {
422 return null;
423 }
424
425 /***
426 * Creates an <code>EntityReference</code> object. In addition, if the
427 * referenced entity is known, the child list of the
428 * <code>EntityReference</code> node is made the same as that of the
429 * corresponding <code>Entity</code> node.If any descendant of the
430 * <code>Entity</code> node has an unbound namespace prefix, the
431 * corresponding descendant of the created <code>EntityReference</code>
432 * node is also unbound; (its <code>namespaceURI</code> is
433 * <code>null</code>). The DOM Level 2 does not support any mechanism to
434 * resolve namespace prefixes.
435 * @param name The name of the entity to reference.
436 * @return The new <code>EntityReference</code> object.
437 */
438 public org.w3c.dom.EntityReference createEntityReference(final String name) {
439
440 throw new UnsupportedOperationException(
441 "Method createEntityReference() "
442 + "not yet implemented."
443 );
444 }
445
446 /***
447 * Creates a <code>CDATASection</code> node whose value is the specified
448 * string.
449 * @param data The data for the <code>CDATASection</code> contents.
450 * @return The new <code>CDATASection</code> object.
451 */
452 public org.w3c.dom.CDATASection createCDATASection(final String data) {
453
454 throw new UnsupportedOperationException(
455 "Method createCDATASection() "
456 + "not yet implemented."
457 );
458 }
459
460 public CDATA createCDATASection( final CDATADescriptor descriptor,
461 final Object bean ){
462 return new CDATA( this, descriptor, bean );
463 }
464
465 /***
466 * Creates a <code>Text</code> node given the specified string.
467 * @param data The data for the node.
468 * @return The new <code>Text</code> object.
469 */
470 public org.w3c.dom.Text createTextNode(final String data) {
471 throw new UnsupportedOperationException(
472 "Method createTextNode() "
473 + "not yet implemented."
474 );
475 }
476
477 /***
478 * Returns the <code>Element</code> whose <code>ID</code> is given by
479 * <code>elementId</code>. If no such element exists, returns
480 * <code>null</code>. Behavior is not defined if more than one element
481 * has this <code>ID</code>. The DOM implementation must have
482 * information that says which attributes are of type ID. Attributes
483 * with the name "ID" are not of type ID unless so defined.
484 * Implementations that do not know whether attributes are of type ID or
485 * not are expected to return <code>null</code>.
486 * @param elementId The unique <code>id</code> value for an element.
487 * @return The matching element.
488 * @since DOM Level 2
489 */
490 public org.w3c.dom.Element getElementById(final String elementId) {
491 throw new UnsupportedOperationException(
492 "Method getElementById() "
493 + "not yet implemented."
494 );
495 }
496
497 /***
498 * Creates an element of the type specified. Note that the instance
499 * returned implements the <code>Element</code> interface, so attributes
500 * can be specified directly on the returned object.
501 * <br>In addition, if there are known attributes with default values,
502 * <code>Attr</code> nodes representing them are automatically created
503 * and attached to the element.
504 * <br>To create an element with a qualified name and namespace URI, use
505 * the <code>createElementNS</code> method.
506 * @param tagName The name of the element type to instantiate. For XML,
507 * this is case-sensitive. For HTML, the <code>tagName</code>
508 * parameter may be provided in any case, but it must be mapped to the
509 * canonical uppercase form by the DOM implementation.
510 * @return A new <code>Element</code> object with the
511 * <code>nodeName</code> attribute set to <code>tagName</code>, and
512 * <code>localName</code>, <code>prefix</code>, and
513 * <code>namespaceURI</code> set to <code>null</code>.
514 */
515 public org.w3c.dom.Element createElement( final String tagName ) {
516 throw new UnsupportedOperationException(
517 "Method createElement() "
518 + "not yet implemented."
519 );
520 }
521
522 public Element createElement( final ElementDescriptor descriptor,
523 final Object bean ) {
524 return new Element( this, descriptor, bean );
525 }
526
527 public Element createElement( final String name, final Object bean ) {
528 return new Element( this, name, bean );
529 }
530
531 /***
532 * Creates an element of the given qualified name and namespace URI.
533 * @param namespaceURI The namespace URI of the element to create.
534 * @param qualifiedName The qualified name of the element type to
535 * instantiate.
536 * @return A new <code>Element</code> object with the following
537 * attributes:
538 * <table border='1'>
539 * <tr>
540 * <th>Attribute</th>
541 * <th>Value</th>
542 * </tr>
543 * <tr>
544 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
545 * <td valign='top' rowspan='1' colspan='1'>
546 * <code>qualifiedName</code></td>
547 * </tr>
548 * <tr>
549 * <td valign='top' rowspan='1' colspan='1'>
550 * <code>Node.namespaceURI</code></td>
551 * <td valign='top' rowspan='1' colspan='1'>
552 * <code>namespaceURI</code></td>
553 * </tr>
554 * <tr>
555 * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
556 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
557 * from <code>qualifiedName</code>, or <code>null</code> if there is
558 * no prefix</td>
559 * </tr>
560 * <tr>
561 * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
562 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
563 * <code>qualifiedName</code></td>
564 * </tr>
565 * <tr>
566 * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
567 * <td valign='top' rowspan='1' colspan='1'>
568 * <code>qualifiedName</code></td>
569 * </tr>
570 * </table>
571 * @since DOM Level 2
572 */
573 public org.w3c.dom.Element createElementNS(final String namespaceURI,
574 final String qualifiedName) {
575 throw new UnsupportedOperationException(
576 "Method createElementNS() "
577 + "not yet implemented."
578 );
579 }
580
581 /***
582 * Creates an <code>Attr</code> of the given name. Note that the
583 * <code>Attr</code> instance can then be set on an <code>Element</code>
584 * using the <code>setAttributeNode</code> method.
585 * <br>To create an attribute with a qualified name and namespace URI, use
586 * the <code>createAttributeNS</code> method.
587 * @param name The name of the attribute.
588 * @return A new <code>Attr</code> object with the <code>nodeName</code>
589 * attribute set to <code>name</code>, and <code>localName</code>,
590 * <code>prefix</code>, and <code>namespaceURI</code> set to
591 * <code>null</code>. The value of the attribute is the empty string.
592 */
593 public org.w3c.dom.Attr createAttribute(final String name) {
594 throw new UnsupportedOperationException(
595 "Method createAttribute() "
596 + "not yet implemented."
597 );
598 }
599
600 public Attribute createAttribute( final AttributeDescriptor descriptor,
601 final Object bean ) {
602 return new Attribute( this, descriptor, bean );
603 }
604
605 public Text createText( final TextDescriptor descriptor,
606 final Object bean ) {
607 return new Text( this, descriptor, bean );
608 }
609
610 /***
611 * Returns the local part of the qualified name of this node.
612 * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
613 * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
614 * method, such as <code>createElement</code> from the
615 * <code>Document</code> interface, this is always <code>null</code>.
616 * @since DOM Level 2
617 */
618 public String getLocalName() {
619 return null;
620 }
621
622 /***
623 * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
624 * given tag name in the order in which they are encountered in a
625 * preorder traversal of the <code>Document</code> tree.
626 * @param tagname The name of the tag to match on. The special value "*"
627 * matches all tags.
628 * @return A new <code>NodeList</code> object containing all the matched
629 * <code>Elements</code>.
630 */
631 public org.w3c.dom.NodeList getElementsByTagName(String tagname) {
632 throw new UnsupportedOperationException(
633 "Method getElementsByTagNameNS() "
634 + "not yet implemented."
635 );
636 }
637
638 /***
639 * Creates a <code>ProcessingInstruction</code> node given the specified
640 * name and data strings.
641 * @param target The target part of the processing instruction.
642 * @param data The data for the node.
643 * @return The new <code>ProcessingInstruction</code> object.
644 */
645 public org.w3c.dom.ProcessingInstruction createProcessingInstruction(
646 final String target, final String data) {
647
648 throw new UnsupportedOperationException(
649 "Method createProcessingInstruction() "
650 + "not yet implemented."
651 );
652 }
653
654 /***
655 * The namespace prefix of this node, or <code>null</code> if it is
656 * unspecified.
657 * <br>Note that setting this attribute, when permitted, changes the
658 * <code>nodeName</code> attribute, which holds the qualified name, as
659 * well as the <code>tagName</code> and <code>name</code> attributes of
660 * the <code>Element</code> and <code>Attr</code> interfaces, when
661 * applicable.
662 * <br>Note also that changing the prefix of an attribute that is known to
663 * have a default value, does not make a new attribute with the default
664 * value and the original prefix appear, since the
665 * <code>namespaceURI</code> and <code>localName</code> do not change.
666 * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
667 * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
668 * method, such as <code>createElement</code> from the
669 * <code>Document</code> interface, this is always <code>null</code>.
670 * @since DOM Level 2
671 */
672 public void setPrefix( final String prefix ) {
673 throw new UnsupportedOperationException(
674 "Method setPrefix( String ) "
675 + "not yet implemented."
676 );
677
678 }
679
680 public boolean accept( final Filter filter ) {
681 return true;
682 }
683
684 public static class NodeList extends LinkedList
685 implements org.w3c.dom.NodeList {
686
687 /***
688 * The number of nodes in the list. The range of valid child node indices
689 * is 0 to <code>length-1</code> inclusive.
690 */
691 public int getLength() {
692 return this.size();
693 }
694
695 /***
696 * Returns the <code>index</code>th item in the collection. If
697 * <code>index</code> is greater than or equal to the number of nodes in
698 * the list, this returns <code>null</code>.
699 * @param index Index into the collection.
700 * @return The node at the <code>index</code>th position in the
701 * <code>NodeList</code>, or <code>null</code> if that is not a valid
702 * index.
703 */
704 public org.w3c.dom.Node item( final int index ) {
705 return (org.w3c.dom.Node) this.get(index);
706 }
707
708 }
709 }
This page was automatically generated by Maven