Source Code Cross Referenced for DocumentTypeImpl.java in  » Web-Server » Rimfaxe-Web-Server » org » apache » xerces » 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 » Web Server » Rimfaxe Web Server » org.apache.xerces.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Apache Software License, Version 1.1
003:         *
004:         *
005:         * Copyright (c) 1999 The Apache Software Foundation.  All rights 
006:         * reserved.
007:         *
008:         * Redistribution and use in source and binary forms, with or without
009:         * modification, are permitted provided that the following conditions
010:         * are met:
011:         *
012:         * 1. Redistributions of source code must retain the above copyright
013:         *    notice, this list of conditions and the following disclaimer. 
014:         *
015:         * 2. Redistributions in binary form must reproduce the above copyright
016:         *    notice, this list of conditions and the following disclaimer in
017:         *    the documentation and/or other materials provided with the
018:         *    distribution.
019:         *
020:         * 3. The end-user documentation included with the redistribution,
021:         *    if any, must include the following acknowledgment:  
022:         *       "This product includes software developed by the
023:         *        Apache Software Foundation (http://www.apache.org/)."
024:         *    Alternately, this acknowledgment may appear in the software itself,
025:         *    if and wherever such third-party acknowledgments normally appear.
026:         *
027:         * 4. The names "Xerces" and "Apache Software Foundation" must
028:         *    not be used to endorse or promote products derived from this
029:         *    software without prior written permission. For written 
030:         *    permission, please contact apache@apache.org.
031:         *
032:         * 5. Products derived from this software may not be called "Apache",
033:         *    nor may "Apache" appear in their name, without prior written
034:         *    permission of the Apache Software Foundation.
035:         *
036:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         * SUCH DAMAGE.
048:         * ====================================================================
049:         *
050:         * This software consists of voluntary contributions made by many
051:         * individuals on behalf of the Apache Software Foundation and was
052:         * originally based on software copyright (c) 1999, International
053:         * Business Machines, Inc., http://www.apache.org.  For more
054:         * information on the Apache Software Foundation, please see
055:         * <http://www.apache.org/>.
056:         */
057:
058:        package org.apache.xerces.dom;
059:
060:        import org.w3c.dom.DocumentType;
061:        import org.w3c.dom.Node;
062:        import org.w3c.dom.NamedNodeMap;
063:
064:        /**
065:         * This class represents a Document Type <em>declaraction</em> in
066:         * the document itself, <em>not</em> a Document Type Definition (DTD).
067:         * An XML document may (or may not) have such a reference.
068:         * <P>
069:         * DocumentType is an Extended DOM feature, used in XML documents but
070:         * not in HTML.
071:         * <P>
072:         * Note that Entities and Notations are no longer children of the
073:         * DocumentType, but are parentless nodes hung only in their
074:         * appropriate NamedNodeMaps.
075:         * <P>
076:         * This area is UNDERSPECIFIED IN REC-DOM-Level-1-19981001
077:         * Most notably, absolutely no provision was made for storing
078:         * and using Element and Attribute information. Nor was the linkage
079:         * between Entities and Entity References nailed down solidly.
080:         *
081:         * @author Arnaud  Le Hors, IBM
082:         * @author Joe Kesselman, IBM
083:         * @author Andy Clark, IBM
084:         * @version
085:         * @since  PR-DOM-Level-1-19980818.
086:         */
087:        public class DocumentTypeImpl extends ParentNode implements 
088:                DocumentType {
089:
090:            //
091:            // Constants
092:            //
093:
094:            /** Serialization version. */
095:            static final long serialVersionUID = 7751299192316526485L;
096:
097:            //
098:            // Data
099:            //
100:
101:            /** Document type name. */
102:            protected String name;
103:
104:            /** Entities. */
105:            protected NamedNodeMapImpl entities;
106:
107:            /** Notations. */
108:            protected NamedNodeMapImpl notations;
109:
110:            // NON-DOM
111:
112:            /** Elements. */
113:            protected NamedNodeMapImpl elements;
114:
115:            // DOM2: support public ID.
116:            protected String publicID;
117:
118:            // DOM2: support system ID.
119:            protected String systemID;
120:
121:            // DOM2: support internal subset.
122:            protected String internalSubset;
123:
124:            //
125:            // Constructors
126:            //
127:
128:            /** Factory method for creating a document type node. */
129:            public DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name) {
130:                super (ownerDocument);
131:
132:                this .name = name;
133:                // DOM
134:                entities = new NamedNodeMapImpl(this );
135:                notations = new NamedNodeMapImpl(this );
136:
137:                // NON-DOM
138:                elements = new NamedNodeMapImpl(this );
139:
140:            } // <init>(CoreDocumentImpl,String)
141:
142:            /** Factory method for creating a document type node. */
143:            public DocumentTypeImpl(CoreDocumentImpl ownerDocument,
144:                    String qualifiedName, String publicID, String systemID) {
145:                this (ownerDocument, qualifiedName);
146:                this .publicID = publicID;
147:                this .systemID = systemID;
148:
149:            } // <init>(CoreDocumentImpl,String)
150:
151:            //
152:            // DOM2: methods.
153:            //
154:
155:            /**
156:             * Introduced in DOM Level 2. <p>
157:             * 
158:             * Return the public identifier of this Document type.
159:             * @since WD-DOM-Level-2-19990923
160:             */
161:            public String getPublicId() {
162:                if (needsSyncData()) {
163:                    synchronizeData();
164:                }
165:                return publicID;
166:            }
167:
168:            /**
169:             * Introduced in DOM Level 2. <p>
170:             * 
171:             * Return the system identifier of this Document type.
172:             * @since WD-DOM-Level-2-19990923
173:             */
174:            public String getSystemId() {
175:                if (needsSyncData()) {
176:                    synchronizeData();
177:                }
178:                return systemID;
179:            }
180:
181:            /**
182:             * NON-DOM. <p>
183:             *
184:             * Set the internalSubset given as a string.
185:             */
186:            public void setInternalSubset(String internalSubset) {
187:                if (needsSyncData()) {
188:                    synchronizeData();
189:                }
190:                this .internalSubset = internalSubset;
191:            }
192:
193:            /**
194:             * Introduced in DOM Level 2. <p>
195:             * 
196:             * Return the internalSubset given as a string.
197:             * @since WD-DOM-Level-2-19990923
198:             */
199:            public String getInternalSubset() {
200:                if (needsSyncData()) {
201:                    synchronizeData();
202:                }
203:                return internalSubset;
204:            }
205:
206:            //
207:            // Node methods
208:            //
209:
210:            /** 
211:             * A short integer indicating what type of node this is. The named
212:             * constants for this value are defined in the org.w3c.dom.Node interface.
213:             */
214:            public short getNodeType() {
215:                return Node.DOCUMENT_TYPE_NODE;
216:            }
217:
218:            /**
219:             * Returns the document type name
220:             */
221:            public String getNodeName() {
222:                if (needsSyncData()) {
223:                    synchronizeData();
224:                }
225:                return name;
226:            }
227:
228:            /** Clones the node. */
229:            public Node cloneNode(boolean deep) {
230:
231:                DocumentTypeImpl newnode = (DocumentTypeImpl) super 
232:                        .cloneNode(deep);
233:                // NamedNodeMaps must be cloned explicitly, to avoid sharing them.
234:                newnode.entities = entities.cloneMap(newnode);
235:                newnode.notations = notations.cloneMap(newnode);
236:                newnode.elements = elements.cloneMap(newnode);
237:
238:                return newnode;
239:
240:            } // cloneNode(boolean):Node
241:
242:            /**
243:             * NON-DOM
244:             * set the ownerDocument of this node and its children
245:             */
246:            void setOwnerDocument(CoreDocumentImpl doc) {
247:                super .setOwnerDocument(doc);
248:                entities.setOwnerDocument(doc);
249:                notations.setOwnerDocument(doc);
250:                elements.setOwnerDocument(doc);
251:            }
252:
253:            //
254:            // DocumentType methods
255:            //
256:
257:            /**
258:             * Name of this document type. If we loaded from a DTD, this should
259:             * be the name immediately following the DOCTYPE keyword.
260:             */
261:            public String getName() {
262:
263:                if (needsSyncData()) {
264:                    synchronizeData();
265:                }
266:                return name;
267:
268:            } // getName():String
269:
270:            /**
271:             * Access the collection of general Entities, both external and
272:             * internal, defined in the DTD. For example, in:
273:             * <p>
274:             * <pre>
275:             *   &lt;!doctype example SYSTEM "ex.dtd" [
276:             *     &lt;!ENTITY foo "foo"&gt;
277:             *     &lt;!ENTITY bar "bar"&gt;
278:             *     &lt;!ENTITY % baz "baz"&gt;
279:             *     ]&gt;
280:             * </pre>
281:             * <p>
282:             * The Entities map includes foo and bar, but not baz. It is promised that
283:             * only Nodes which are Entities will exist in this NamedNodeMap.
284:             * <p>
285:             * For HTML, this will always be null.
286:             * <p>
287:             * Note that "built in" entities such as &amp; and &lt; should be
288:             * converted to their actual characters before being placed in the DOM's
289:             * contained text, and should be converted back when the DOM is rendered
290:             * as XML or HTML, and hence DO NOT appear here.
291:             */
292:            public NamedNodeMap getEntities() {
293:                if (needsSyncChildren()) {
294:                    synchronizeChildren();
295:                }
296:                return entities;
297:            }
298:
299:            /**
300:             * Access the collection of Notations defined in the DTD.  A
301:             * notation declares, by name, the format of an XML unparsed entity
302:             * or is used to formally declare a Processing Instruction target.
303:             */
304:            public NamedNodeMap getNotations() {
305:                if (needsSyncChildren()) {
306:                    synchronizeChildren();
307:                }
308:                return notations;
309:            }
310:
311:            //
312:            // Public methods
313:            //
314:
315:            /**
316:             * NON-DOM: Subclassed to flip the entities' and notations' readonly switch
317:             * as well.
318:             * @see NodeImpl#setReadOnly
319:             */
320:            public void setReadOnly(boolean readOnly, boolean deep) {
321:
322:                if (needsSyncChildren()) {
323:                    synchronizeChildren();
324:                }
325:                super .setReadOnly(readOnly, deep);
326:
327:                // set read-only property
328:                elements.setReadOnly(readOnly, true);
329:                entities.setReadOnly(readOnly, true);
330:                notations.setReadOnly(readOnly, true);
331:
332:            } // setReadOnly(boolean,boolean)
333:
334:            /**
335:             * NON-DOM: Access the collection of ElementDefinitions.
336:             * @see ElementDefinitionImpl
337:             */
338:            public NamedNodeMap getElements() {
339:                if (needsSyncChildren()) {
340:                    synchronizeChildren();
341:                }
342:                return elements;
343:            }
344:
345:        } // class DocumentTypeImpl
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.