Source Code Cross Referenced for DocumentOverNodeInfo.java in  » XML » saxonb » net » sf » saxon » dom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » saxonb » net.sf.saxon.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sf.saxon.dom;
002:
003:        import net.sf.saxon.om.Axis;
004:        import net.sf.saxon.om.AxisIterator;
005:        import net.sf.saxon.om.DocumentInfo;
006:        import net.sf.saxon.om.NodeInfo;
007:        import net.sf.saxon.type.Type;
008:        import org.w3c.dom.*;
009:
010:        import java.util.ArrayList;
011:
012:        /**
013:         * This class is an implementation of the DOM Document class that wraps a Saxon DocumentInfo
014:         * representation of a document node.
015:         */
016:
017:        public class DocumentOverNodeInfo extends NodeOverNodeInfo implements 
018:                Document {
019:
020:            /**
021:             * Get the Document Type Declaration (see <code>DocumentType</code> )
022:             * associated with this document. For HTML documents as well as XML
023:             * documents without a document type declaration this returns
024:             * <code>null</code>. DOM method.
025:             * @return null: The Saxon tree model does not include the document type
026:             * information.
027:             */
028:
029:            public DocumentType getDoctype() {
030:                return null;
031:            }
032:
033:            /**
034:             * Get a <code>DOMImplementation</code> object that handles this document.
035:             * A DOM application may use objects from multiple implementations.
036:             * DOM method.
037:             */
038:
039:            public DOMImplementation getImplementation() {
040:                return new DOMImplementationImpl();
041:            }
042:
043:            /**
044:             * Creates an element of the type specified. DOM method: always fails,
045:             * because the Saxon tree is not updateable.
046:             */
047:
048:            public Element createElement(String tagName) throws DOMException {
049:                disallowUpdate();
050:                return null;
051:            }
052:
053:            /**
054:             * Creates an empty <code>DocumentFragment</code> object.
055:             * @return  A new <code>DocumentFragment</code> .
056:             * DOM method: returns null, because the Saxon tree is not updateable.
057:             */
058:
059:            public DocumentFragment createDocumentFragment() {
060:                return null;
061:            }
062:
063:            /**
064:             * Create a <code>Text</code> node given the specified string.
065:             * DOM method: returns null, because the Saxon tree is not updateable.
066:             * @param data  The data for the node.
067:             * @return  The new <code>Text</code> object.
068:             */
069:
070:            public Text createTextNode(String data) {
071:                return null;
072:            }
073:
074:            /**
075:             * Create a <code>Comment</code> node given the specified string.
076:             * DOM method: returns null, because the Saxon tree is not updateable.
077:             * @param data  The data for the node.
078:             * @return  The new <code>Comment</code> object.
079:             */
080:            public Comment createComment(String data) {
081:                return null;
082:            }
083:
084:            /**
085:             * Create a <code>CDATASection</code> node whose value  is the specified
086:             * string.
087:             * DOM method: always fails, because the Saxon tree is not updateable.
088:             * @param data  The data for the <code>CDATASection</code> contents.
089:             * @return  The new <code>CDATASection</code> object.
090:             * @exception org.w3c.dom.DOMException
091:             *    NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
092:             */
093:
094:            public CDATASection createCDATASection(String data)
095:                    throws DOMException {
096:                disallowUpdate();
097:                return null;
098:            }
099:
100:            /**
101:             * Create a <code>ProcessingInstruction</code> node given the specified
102:             * name and data strings.
103:             * DOM method: returns null, because the Saxon tree is not updateable.
104:             * @param target  The target part of the processing instruction.
105:             * @param data  The data for the node.
106:             * @return  The new <code>ProcessingInstruction</code> object.
107:             * @exception org.w3c.dom.DOMException
108:             *    INVALID_CHARACTER_ERR: Raised if the specified target contains an
109:             *   illegal character.
110:             *   <br> NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
111:             */
112:
113:            public ProcessingInstruction createProcessingInstruction(
114:                    String target, String data) throws DOMException {
115:                disallowUpdate();
116:                return null;
117:            }
118:
119:            /**
120:             * Create an <code>Attr</code> of the given name.
121:             * DOM method: always fails, because the Saxon tree is not updateable.
122:             * @param name  The name of the attribute.
123:             * @return  A new <code>Attr</code> object with the <code>nodeName</code>
124:             *   attribute set to <code>name</code> , and <code>localName</code> ,
125:             *   <code>prefix</code> , and <code>namespaceURI</code> set to
126:             *   <code>null</code> .
127:             * @exception org.w3c.dom.DOMException
128:             *    INVALID_CHARACTER_ERR: Raised if the specified name contains an
129:             *   illegal character.
130:             */
131:
132:            public Attr createAttribute(String name) throws DOMException {
133:                disallowUpdate();
134:                return null;
135:            }
136:
137:            /**
138:             * Create an <code>EntityReference</code> object.
139:             * DOM method: returns null, because the Saxon tree is not updateable.
140:             * @param name  The name of the entity to reference.
141:             * @return  The new <code>EntityReference</code> object.
142:             * @exception org.w3c.dom.DOMException
143:             *    INVALID_CHARACTER_ERR: Raised if the specified name contains an
144:             *   illegal character.
145:             *   <br> NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
146:             */
147:
148:            public EntityReference createEntityReference(String name)
149:                    throws DOMException {
150:                disallowUpdate();
151:                return null;
152:            }
153:
154:            /**
155:             * Return a <code>NodeList</code> of all the <code>Elements</code> with
156:             * a given tag name in the order in which they are encountered in a
157:             * preorder traversal of the <code>Document</code> tree.
158:             * @param tagname  The name of the tag to match on. The special value "*"
159:             *   matches all tags.
160:             * @return  A new <code>NodeList</code> object containing all the matched
161:             *   <code>Elements</code> .
162:             */
163:
164:            public NodeList getElementsByTagName(String tagname) {
165:                return getElementsByTagName(node, tagname);
166:            }
167:
168:            protected static NodeList getElementsByTagName(NodeInfo node,
169:                    String tagname) {
170:                AxisIterator allElements = node.iterateAxis(Axis.DESCENDANT);
171:                ArrayList nodes = new ArrayList(100);
172:                while (true) {
173:                    NodeInfo next = (NodeInfo) allElements.next();
174:                    if (next == null) {
175:                        break;
176:                    }
177:                    if (next.getNodeKind() == Type.ELEMENT) {
178:                        if (tagname.equals("*")
179:                                || tagname.equals(next.getDisplayName())) {
180:                            nodes.add(NodeOverNodeInfo.wrap(next));
181:                        }
182:                    }
183:                }
184:                return new DOMNodeList(nodes);
185:            }
186:
187:            /**
188:             * Import a node from another document to this document.
189:             * DOM method: always fails, because the Saxon tree is not updateable.
190:             * @exception org.w3c.dom.DOMException
191:             * @since DOM Level 2
192:             */
193:
194:            public Node importNode(Node importedNode, boolean deep)
195:                    throws DOMException {
196:                disallowUpdate();
197:                return null;
198:            }
199:
200:            /**
201:             * Create an element of the given qualified name and namespace URI.
202:             * HTML-only DOM implementations do not need to implement this method.
203:             * DOM method: always fails, because the Saxon tree is not updateable.
204:             * @param namespaceURI  The  namespace URI of the element to create.
205:             * @param qualifiedName  The  qualified name of the element type to
206:             *   instantiate.
207:             * @return  A new <code>Element</code> object
208:             * @exception org.w3c.dom.DOMException
209:             */
210:
211:            public Element createElementNS(String namespaceURI,
212:                    String qualifiedName) throws DOMException {
213:                disallowUpdate();
214:                return null;
215:            }
216:
217:            /**
218:             * Create an attribute of the given qualified name and namespace URI.
219:             * HTML-only DOM implementations do not need to implement this method.
220:             * DOM method: returns null, because the Saxon tree is not updateable.
221:             * @param namespaceURI  The  namespace URI of the attribute to create.
222:             * @param qualifiedName  The  qualified name of the attribute to
223:             *   instantiate.
224:             * @return  A new <code>Attr</code> object.
225:             * @exception org.w3c.dom.DOMException
226:             */
227:
228:            public Attr createAttributeNS(String namespaceURI,
229:                    String qualifiedName) throws DOMException {
230:                disallowUpdate();
231:                return null;
232:            }
233:
234:            /**
235:             * Return a <code>NodeList</code> of all the <code>Elements</code> with
236:             * a given  local name and namespace URI in the order in which they are
237:             * encountered in a preorder traversal of the <code>Document</code> tree.
238:             * DOM method.
239:             * @param namespaceURI  The  namespace URI of the elements to match on.
240:             *   The special value "*" matches all namespaces.
241:             * @param localName  The  local name of the elements to match on. The
242:             *   special value "*" matches all local names.
243:             * @return  A new <code>NodeList</code> object containing all the matched
244:             *   <code>Elements</code> .
245:             * @since DOM Level 2
246:             */
247:
248:            public NodeList getElementsByTagNameNS(String namespaceURI,
249:                    String localName) {
250:                return getElementsByTagNameNS(node, namespaceURI, localName);
251:            }
252:
253:            public static NodeList getElementsByTagNameNS(NodeInfo node,
254:                    String namespaceURI, String localName) {
255:                AxisIterator allElements = node.iterateAxis(Axis.DESCENDANT);
256:                ArrayList nodes = new ArrayList(100);
257:                while (true) {
258:                    NodeInfo next = (NodeInfo) allElements.next();
259:                    if (next == null) {
260:                        break;
261:                    }
262:                    if (next.getNodeKind() == Type.ELEMENT) {
263:                        if ((namespaceURI.equals("*") || namespaceURI
264:                                .equals(next.getURI()))
265:                                && (localName.equals("*") || localName
266:                                        .equals(next.getLocalPart()))) {
267:                            nodes.add(NodeOverNodeInfo.wrap(next));
268:                        }
269:                    }
270:                }
271:                return new DOMNodeList(nodes);
272:            }
273:
274:            /**
275:             * Return the <code>Element</code> whose <code>ID</code> is given by
276:             * <code>elementId</code> . If no such element exists, returns
277:             * <code>null</code> . Behavior is not defined if more than one element
278:             * has this <code>ID</code> .  The DOM implementation must have
279:             * information that says which attributes are of type ID. Attributes with
280:             * the name "ID" are not of type ID unless so defined. Implementations
281:             * that do not know whether attributes are of type ID or not are expected
282:             * to return <code>null</code> .
283:             * @param elementId  The unique <code>id</code> value for an element.
284:             * @return  The matching element, or null if there is none.
285:             * @since DOM Level 2
286:             */
287:
288:            public Element getElementById(String elementId) {
289:                // Defined on Document node; but we support it on any node.
290:                DocumentInfo doc = node.getDocumentRoot();
291:                if (doc == null) {
292:                    return null;
293:                }
294:                return (Element) wrap(doc.selectID(elementId));
295:            }
296:
297:            /**
298:             * An attribute specifying the encoding used for this document at the time
299:             * of the parsing. This is <code>null</code> when it is not known, such
300:             * as when the <code>Document</code> was created in memory.
301:             *
302:             * @since DOM Level 3
303:             */
304:            public String getInputEncoding() {
305:                return null;
306:            }
307:
308:            /**
309:             * An attribute specifying, as part of the
310:             * <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>,
311:             * the encoding of this document. This is <code>null</code> when
312:             * unspecified or when it is not known, such as when the
313:             * <code>Document</code> was created in memory.
314:             *
315:             * @since DOM Level 3
316:             */
317:            public String getXmlEncoding() {
318:                return null;
319:            }
320:
321:            /**
322:             * An attribute specifying, as part of the
323:             * <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>,
324:             * whether this document is standalone. This is <code>false</code> when
325:             * unspecified.
326:             * <p ><b>Note:</b>  No verification is done on the value when setting
327:             * this attribute. Applications should use
328:             * <code>Document.normalizeDocument()</code> with the "validate"
329:             * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
330:             * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
331:             *
332:             * @since DOM Level 3
333:             */
334:            public boolean getXmlStandalone() {
335:                return false;
336:            }
337:
338:            /**
339:             * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when
340:             * unspecified.
341:             * <p ><b>Note:</b>  No verification is done on the value when setting
342:             * this attribute. Applications should use
343:             * <code>Document.normalizeDocument()</code> with the "validate"
344:             * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
345:             * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
346:             *
347:             * @throws org.w3c.dom.DOMException NOT_SUPPORTED_ERR: Raised if this document does not support the
348:             *                                  "XML" feature.
349:             * @since DOM Level 3
350:             */
351:            public void setXmlStandalone(boolean xmlStandalone)
352:                    throws DOMException {
353:                disallowUpdate();
354:            }
355:
356:            /**
357:             * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if
358:             * this document supports the "XML" feature, the value is
359:             * <code>"1.0"</code>. If this document does not support the "XML"
360:             * feature, the value is always <code>null</code>. Changing this
361:             * attribute will affect methods that check for invalid characters in
362:             * XML names. Application should invoke
363:             * <code>Document.normalizeDocument()</code> in order to check for
364:             * invalid characters in the <code>Node</code>s that are already part of
365:             * this <code>Document</code>.
366:             * <br> DOM applications may use the
367:             * <code>DOMImplementation.hasFeature(feature, version)</code> method
368:             * with parameter values "XMLVersion" and "1.0" (respectively) to
369:             * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
370:             * applications may use the same method with parameter values
371:             * "XMLVersion" and "1.1" (respectively) to determine if an
372:             * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
373:             * cases, in order to support XML, an implementation must also support
374:             * the "XML" feature defined in this specification. <code>Document</code>
375:             * objects supporting a version of the "XMLVersion" feature must not
376:             * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
377:             * number when using <code>Document.xmlVersion</code>.
378:             *
379:             * @since DOM Level 3
380:             */
381:            public String getXmlVersion() {
382:                return "1.0";
383:            }
384:
385:            /**
386:             * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if
387:             * this document supports the "XML" feature, the value is
388:             * <code>"1.0"</code>. If this document does not support the "XML"
389:             * feature, the value is always <code>null</code>. Changing this
390:             * attribute will affect methods that check for invalid characters in
391:             * XML names. Application should invoke
392:             * <code>Document.normalizeDocument()</code> in order to check for
393:             * invalid characters in the <code>Node</code>s that are already part of
394:             * this <code>Document</code>.
395:             * <br> DOM applications may use the
396:             * <code>DOMImplementation.hasFeature(feature, version)</code> method
397:             * with parameter values "XMLVersion" and "1.0" (respectively) to
398:             * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
399:             * applications may use the same method with parameter values
400:             * "XMLVersion" and "1.1" (respectively) to determine if an
401:             * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
402:             * cases, in order to support XML, an implementation must also support
403:             * the "XML" feature defined in this specification. <code>Document</code>
404:             * objects supporting a version of the "XMLVersion" feature must not
405:             * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
406:             * number when using <code>Document.xmlVersion</code>.
407:             *
408:             * @throws org.w3c.dom.DOMException NOT_SUPPORTED_ERR: Raised if the version is set to a value that is
409:             *                                  not supported by this <code>Document</code> or if this document
410:             *                                  does not support the "XML" feature.
411:             * @since DOM Level 3
412:             */
413:            public void setXmlVersion(String xmlVersion) throws DOMException {
414:                disallowUpdate();
415:            }
416:
417:            /**
418:             * An attribute specifying whether error checking is enforced or not. When
419:             * set to <code>false</code>, the implementation is free to not test
420:             * every possible error case normally defined on DOM operations, and not
421:             * raise any <code>DOMException</code> on DOM operations or report
422:             * errors while using <code>Document.normalizeDocument()</code>. In case
423:             * of error, the behavior is undefined. This attribute is
424:             * <code>true</code> by default.
425:             *
426:             * @since DOM Level 3
427:             */
428:            public boolean getStrictErrorChecking() {
429:                return false;
430:            }
431:
432:            /**
433:             * An attribute specifying whether error checking is enforced or not. When
434:             * set to <code>false</code>, the implementation is free to not test
435:             * every possible error case normally defined on DOM operations, and not
436:             * raise any <code>DOMException</code> on DOM operations or report
437:             * errors while using <code>Document.normalizeDocument()</code>. In case
438:             * of error, the behavior is undefined. This attribute is
439:             * <code>true</code> by default.
440:             *
441:             * @since DOM Level 3
442:             */
443:            public void setStrictErrorChecking(boolean strictErrorChecking) {
444:                //no-op
445:            }
446:
447:            /**
448:             * The location of the document or <code>null</code> if undefined or if
449:             * the <code>Document</code> was created using
450:             * <code>DOMImplementation.createDocument</code>. No lexical checking is
451:             * performed when setting this attribute; this could result in a
452:             * <code>null</code> value returned when using <code>Node.baseURI</code>
453:             * .
454:             * <br> Beware that when the <code>Document</code> supports the feature
455:             * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
456:             * , the href attribute of the HTML BASE element takes precedence over
457:             * this attribute when computing <code>Node.baseURI</code>.
458:             *
459:             * @since DOM Level 3
460:             */
461:            public String getDocumentURI() {
462:                return node.getSystemId();
463:            }
464:
465:            /**
466:             * The location of the document or <code>null</code> if undefined or if
467:             * the <code>Document</code> was created using
468:             * <code>DOMImplementation.createDocument</code>. No lexical checking is
469:             * performed when setting this attribute; this could result in a
470:             * <code>null</code> value returned when using <code>Node.baseURI</code>
471:             * .
472:             * <br> Beware that when the <code>Document</code> supports the feature
473:             * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
474:             * , the href attribute of the HTML BASE element takes precedence over
475:             * this attribute when computing <code>Node.baseURI</code>.
476:             *
477:             * @since DOM Level 3
478:             */
479:            public void setDocumentURI(String documentURI) {
480:                disallowUpdate();
481:            }
482:
483:            /**
484:             * Attempts to adopt a node from another document to this document. If
485:             * supported, it changes the <code>ownerDocument</code> of the source
486:             * node, its children, as well as the attached attribute nodes if there
487:             * are any. If the source node has a parent it is first removed from the
488:             * child list of its parent. This effectively allows moving a subtree
489:             * from one document to another (unlike <code>importNode()</code> which
490:             * create a copy of the source node instead of moving it). When it
491:             * fails, applications should use <code>Document.importNode()</code>
492:             * instead. Note that if the adopted node is already part of this
493:             * document (i.e. the source and target document are the same), this
494:             * method still has the effect of removing the source node from the
495:             * child list of its parent, if any. The following list describes the
496:             * specifics for each type of node.
497:             * <dl>
498:             * <dt>ATTRIBUTE_NODE</dt>
499:             * <dd>The
500:             * <code>ownerElement</code> attribute is set to <code>null</code> and
501:             * the <code>specified</code> flag is set to <code>true</code> on the
502:             * adopted <code>Attr</code>. The descendants of the source
503:             * <code>Attr</code> are recursively adopted.</dd>
504:             * <dt>DOCUMENT_FRAGMENT_NODE</dt>
505:             * <dd>The
506:             * descendants of the source node are recursively adopted.</dd>
507:             * <dt>DOCUMENT_NODE</dt>
508:             * <dd>
509:             * <code>Document</code> nodes cannot be adopted.</dd>
510:             * <dt>DOCUMENT_TYPE_NODE</dt>
511:             * <dd>
512:             * <code>DocumentType</code> nodes cannot be adopted.</dd>
513:             * <dt>ELEMENT_NODE</dt>
514:             * <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes
515:             * are discarded, though if the document being adopted into defines
516:             * default attributes for this element name, those are assigned. The
517:             * descendants of the source element are recursively adopted.</dd>
518:             * <dt>ENTITY_NODE</dt>
519:             * <dd>
520:             * <code>Entity</code> nodes cannot be adopted.</dd>
521:             * <dt>ENTITY_REFERENCE_NODE</dt>
522:             * <dd>Only
523:             * the <code>EntityReference</code> node itself is adopted, the
524:             * descendants are discarded, since the source and destination documents
525:             * might have defined the entity differently. If the document being
526:             * imported into provides a definition for this entity name, its value
527:             * is assigned.</dd>
528:             * <dt>NOTATION_NODE</dt>
529:             * <dd><code>Notation</code> nodes cannot be
530:             * adopted.</dd>
531:             * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE,
532:             * COMMENT_NODE</dt>
533:             * <dd>These nodes can all be adopted. No specifics.</dd>
534:             * </dl>
535:             * <p ><b>Note:</b>  Since it does not create new nodes unlike the
536:             * <code>Document.importNode()</code> method, this method does not raise
537:             * an <code>INVALID_CHARACTER_ERR</code> exception, and applications
538:             * should use the <code>Document.normalizeDocument()</code> method to
539:             * check if an imported name is not an XML name according to the XML
540:             * version in use.
541:             *
542:             * @param source The node to move into this document.
543:             * @return The adopted node, or <code>null</code> if this operation
544:             *         fails, such as when the source node comes from a different
545:             *         implementation.
546:             * @throws org.w3c.dom.DOMException NOT_SUPPORTED_ERR: Raised if the source node is of type
547:             *                                  <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
548:             *                                  <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
549:             *                                  readonly.
550:             * @since DOM Level 3
551:             */
552:            public Node adoptNode(Node source) throws DOMException {
553:                disallowUpdate();
554:                return null;
555:            }
556:
557:            /**
558:             * The configuration used when <code>Document.normalizeDocument()</code>
559:             * is invoked.
560:             *
561:             * @since DOM Level 3
562:             */
563:            public DOMConfiguration getDomConfig() {
564:                return null;
565:            }
566:
567:            /**
568:             * This method acts as if the document was going through a save and load
569:             * cycle, putting the document in a "normal" form. As a consequence,
570:             * this method updates the replacement tree of
571:             * <code>EntityReference</code> nodes and normalizes <code>Text</code>
572:             * nodes, as defined in the method <code>Node.normalize()</code>.
573:             * <br> Otherwise, the actual result depends on the features being set on
574:             * the <code>Document.domConfig</code> object and governing what
575:             * operations actually take place. Noticeably this method could also
576:             * make the document namespace well-formed according to the algorithm
577:             * described in , check the character normalization, remove the
578:             * <code>CDATASection</code> nodes, etc. See
579:             * <code>DOMConfiguration</code> for details.
580:             * <pre>// Keep in the document
581:             * the information defined // in the XML Information Set (Java example)
582:             * DOMConfiguration docConfig = myDocument.getDomConfig();
583:             * docConfig.setParameter("infoset", Boolean.TRUE);
584:             * myDocument.normalizeDocument();</pre>
585:             * <p/>
586:             * <br>Mutation events, when supported, are generated to reflect the
587:             * changes occurring on the document.
588:             * <br> If errors occur during the invocation of this method, such as an
589:             * attempt to update a read-only node or a <code>Node.nodeName</code>
590:             * contains an invalid character according to the XML version in use,
591:             * errors or warnings (<code>DOMError.SEVERITY_ERROR</code> or
592:             * <code>DOMError.SEVERITY_WARNING</code>) will be reported using the
593:             * <code>DOMErrorHandler</code> object associated with the "error-handler
594:             * " parameter. Note this method might also report fatal errors (
595:             * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation
596:             * cannot recover from an error.
597:             *
598:             * @since DOM Level 3
599:             */
600:            public void normalizeDocument() {
601:                disallowUpdate();
602:            }
603:
604:            /**
605:             * Rename an existing node of type <code>ELEMENT_NODE</code> or
606:             * <code>ATTRIBUTE_NODE</code>. Not supported in this implementation
607:             *
608:             * @param n             The node to rename.
609:             * @param namespaceURI  The new namespace URI.
610:             * @param qualifiedName The new qualified name.
611:             * @return The renamed node. This is either the specified node or the new
612:             *         node that was created to replace the specified node.
613:             * @throws org.w3c.dom.DOMException
614:             */
615:            public Node renameNode(Node n, String namespaceURI,
616:                    String qualifiedName) throws DOMException {
617:                disallowUpdate();
618:                return null;
619:            }
620:
621:        }
622:
623:        //
624:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
625:        // you may not use this file except in compliance with the License. You may obtain a copy of the
626:        // License at http://www.mozilla.org/MPL/
627:        //
628:        // Software distributed under the License is distributed on an "AS IS" basis,
629:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
630:        // See the License for the specific language governing rights and limitations under the License.
631:        //
632:        // The Original Code is: all this file.
633:        //
634:        // The Initial Developer of the Original Code is Michael H. Kay.
635:        //
636:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
637:        //
638:        // Contributor(s): none.
639:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.