Source Code Cross Referenced for DocumentWrapper.java in  » XML » XPath-Saxon » 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 » XPath Saxon » 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.Configuration;
004:        import net.sf.saxon.om.DocumentInfo;
005:        import net.sf.saxon.om.NamePool;
006:        import net.sf.saxon.om.NodeInfo;
007:        import net.sf.saxon.type.Type;
008:        import org.w3c.dom.Document;
009:        import org.w3c.dom.Node;
010:
011:        import java.lang.reflect.Method;
012:
013:        /**
014:         * The document node of a tree implemented as a wrapper around a DOM Document.
015:         */
016:
017:        public class DocumentWrapper extends NodeWrapper implements 
018:                DocumentInfo {
019:
020:            protected Configuration config;
021:            protected String baseURI;
022:            protected int documentNumber;
023:            protected boolean level3 = false;
024:
025:            public DocumentWrapper(Document doc, String baseURI,
026:                    Configuration config) {
027:                super (doc, null, 0);
028:                node = doc;
029:                nodeKind = Type.DOCUMENT;
030:                this .baseURI = baseURI;
031:                docWrapper = this ;
032:
033:                // Find out if this is a level-3 DOM implementation
034:                Method[] methods = doc.getClass().getMethods();
035:                for (int i = 0; i < methods.length; i++) {
036:                    if (methods[i].getName().equals("isSameNode")) {
037:                        level3 = true;
038:                        break;
039:                    }
040:                }
041:
042:                setConfiguration(config);
043:            }
044:
045:            /**
046:             * Create a wrapper for a node in this document
047:             *
048:             * @param node the DOM node to be wrapped. This must be a node within the document wrapped by this
049:             *             DocumentWrapper
050:             * @throws IllegalArgumentException if the node is not a descendant of the Document node wrapped by
051:             *                                  this DocumentWrapper
052:             */
053:
054:            public NodeWrapper wrap(Node node) {
055:                if (node == this .node) {
056:                    return this ;
057:                }
058:                if (node.getOwnerDocument() == this .node) {
059:                    return makeWrapper(node, this );
060:                } else {
061:                    throw new IllegalArgumentException(
062:                            "DocumentWrapper#wrap: supplied node does not belong to the wrapped DOM document");
063:                }
064:            }
065:
066:            /**
067:             * Set the Configuration that contains this document
068:             */
069:
070:            public void setConfiguration(Configuration config) {
071:                this .config = config;
072:                documentNumber = config.getDocumentNumberAllocator()
073:                        .allocateDocumentNumber();
074:            }
075:
076:            /**
077:             * Get the configuration previously set using setConfiguration
078:             */
079:
080:            public Configuration getConfiguration() {
081:                return config;
082:            }
083:
084:            /**
085:             * Get the name pool used for the names in this document
086:             */
087:
088:            public NamePool getNamePool() {
089:                return config.getNamePool();
090:            }
091:
092:            /**
093:             * Get the unique document number
094:             */
095:
096:            public int getDocumentNumber() {
097:                return documentNumber;
098:            }
099:
100:            /**
101:             * Get the element with a given ID, if any
102:             *
103:             * @param id the required ID value
104:             * @return a NodeInfo representing the element with the given ID, or null if there
105:             *         is no such element. This implementation does not necessarily conform to the
106:             *         rule that if an invalid document contains two elements with the same ID, the one
107:             *         that comes last should be returned.
108:             */
109:
110:            public NodeInfo selectID(String id) {
111:                Node el = ((Document) node).getElementById(id);
112:                if (el == null) {
113:                    return null;
114:                }
115:                return wrap(el);
116:            }
117:
118:            /**
119:             * Determine whether this is the same node as another node. <br />
120:             * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b)
121:             *
122:             * @return true if this Node object and the supplied Node object represent the
123:             *         same node in the tree.
124:             */
125:
126:            public boolean isSameNodeInfo(NodeInfo other) {
127:                if (!(other instanceof  DocumentWrapper)) {
128:                    return false;
129:                }
130:                return node == ((DocumentWrapper) other).node;
131:            }
132:
133:            /**
134:             * Get the unparsed entity with a given name
135:             *
136:             * @param name the name of the entity
137:             * @return null: JDOM does not provide access to unparsed entities
138:             */
139:
140:            public String[] getUnparsedEntity(String name) {
141:                return null;
142:            }
143:
144:        }
145:
146:        //
147:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
148:        // you may not use this file except in compliance with the License. You may obtain a copy of the
149:        // License at http://www.mozilla.org/MPL/
150:        //
151:        // Software distributed under the License is distributed on an "AS IS" basis,
152:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
153:        // See the License for the specific language governing rights and limitations under the License.
154:        //
155:        // The Original Code is: all this file.
156:        //
157:        // The Initial Developer of the Original Code is Michael H. Kay
158:        //
159:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
160:        //
161:        // Contributor(s): none.
162:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.