Source Code Cross Referenced for EntityImpl.java in  » XML » xerces-2_9_1 » 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 » XML » xerces 2_9_1 » org.apache.xerces.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.xerces.dom;
019:
020:        import org.w3c.dom.Entity;
021:        import org.w3c.dom.Node;
022:
023:        /**
024:         * Entity nodes hold the reference data for an XML Entity -- either
025:         * parsed or unparsed. The nodeName (inherited from Node) will contain
026:         * the name (if any) of the Entity. Its data will be contained in the
027:         * Entity's children, in exactly the structure which an
028:         * EntityReference to this name will present within the document's
029:         * body.
030:         * <P>
031:         * Note that this object models the actual entity, _not_ the entity
032:         * declaration or the entity reference.
033:         * <P>
034:         * An XML processor may choose to completely expand entities before
035:         * the structure model is passed to the DOM; in this case, there will
036:         * be no EntityReferences in the DOM tree.
037:         * <P>
038:         * Quoting the 10/01 DOM Proposal,
039:         * <BLOCKQUOTE>
040:         * "The DOM Level 1 does not support editing Entity nodes; if a user
041:         * wants to make changes to the contents of an Entity, every related
042:         * EntityReference node has to be replaced in the structure model by
043:         * a clone of the Entity's contents, and then the desired changes
044:         * must be made to each of those clones instead. All the
045:         * descendants of an Entity node are readonly."
046:         * </BLOCKQUOTE>
047:         * I'm interpreting this as: It is the parser's responsibilty to call
048:         * the non-DOM operation setReadOnly(true,true) after it constructs
049:         * the Entity. Since the DOM explicitly decided not to deal with this,
050:         * _any_ answer will involve a non-DOM operation, and this is the
051:         * simplest solution.
052:         * 
053:         * @xerces.internal
054:         * 
055:         * @author Elena Litani, IBM
056:         * @version $Id: EntityImpl.java 447266 2006-09-18 05:57:49Z mrglavas $
057:         * @since PR-DOM-Level-1-19980818.
058:         */
059:        public class EntityImpl extends ParentNode implements  Entity {
060:
061:            //
062:            // Constants
063:            //
064:
065:            /** Serialization version. */
066:            static final long serialVersionUID = -3575760943444303423L;
067:
068:            //
069:            // Data
070:            //
071:
072:            /** Entity name. */
073:            protected String name;
074:
075:            /** Public identifier. */
076:            protected String publicId;
077:
078:            /** System identifier. */
079:            protected String systemId;
080:
081:            /** Encoding */
082:            protected String encoding;
083:
084:            /** Input Encoding */
085:            protected String inputEncoding;
086:
087:            /** Version */
088:            protected String version;
089:
090:            /** Notation name. */
091:            protected String notationName;
092:
093:            /** base uri*/
094:            protected String baseURI;
095:
096:            //
097:            // Constructors
098:            //
099:
100:            /** Factory constructor. */
101:            public EntityImpl(CoreDocumentImpl ownerDoc, String name) {
102:                super (ownerDoc);
103:                this .name = name;
104:                isReadOnly(true);
105:            }
106:
107:            //
108:            // Node methods
109:            //
110:
111:            /** 
112:             * A short integer indicating what type of node this is. The named
113:             * constants for this value are defined in the org.w3c.dom.Node interface.
114:             */
115:            public short getNodeType() {
116:                return Node.ENTITY_NODE;
117:            }
118:
119:            /**
120:             * Returns the entity name
121:             */
122:            public String getNodeName() {
123:                if (needsSyncData()) {
124:                    synchronizeData();
125:                }
126:                return name;
127:            }
128:
129:            /** Clone node. */
130:            public Node cloneNode(boolean deep) {
131:                EntityImpl newentity = (EntityImpl) super .cloneNode(deep);
132:                newentity.setReadOnly(true, deep);
133:                return newentity;
134:            }
135:
136:            //
137:            // Entity methods
138:            //
139:
140:            /** 
141:             * The public identifier associated with the entity. If not specified,
142:             * this will be null. 
143:             */
144:            public String getPublicId() {
145:
146:                if (needsSyncData()) {
147:                    synchronizeData();
148:                }
149:                return publicId;
150:
151:            } // getPublicId():String
152:
153:            /** 
154:             * The system identifier associated with the entity. If not specified,
155:             * this will be null. 
156:             */
157:            public String getSystemId() {
158:
159:                if (needsSyncData()) {
160:                    synchronizeData();
161:                }
162:                return systemId;
163:
164:            } // getSystemId():String
165:
166:            /** 
167:             * DOM Level 3 WD - experimental
168:             * the version number of this entity, when it is an external parsed entity. 
169:             */
170:            public String getXmlVersion() {
171:
172:                if (needsSyncData()) {
173:                    synchronizeData();
174:                }
175:                return version;
176:
177:            } // getVersion():String
178:
179:            /**
180:             * DOM Level 3 WD - experimental 
181:             * the encoding of this entity, when it is an external parsed entity. 
182:             */
183:            public String getXmlEncoding() {
184:
185:                if (needsSyncData()) {
186:                    synchronizeData();
187:                }
188:
189:                return encoding;
190:
191:            } // getVersion():String
192:
193:            /** 
194:             * Unparsed entities -- which contain non-XML data -- have a
195:             * "notation name" which tells applications how to deal with them.
196:             * Parsed entities, which <em>are</em> in XML format, don't need this and
197:             * set it to null.  
198:             */
199:            public String getNotationName() {
200:
201:                if (needsSyncData()) {
202:                    synchronizeData();
203:                }
204:                return notationName;
205:
206:            } // getNotationName():String
207:
208:            //
209:            // Public methods
210:            //
211:
212:            /**
213:             * DOM Level 2: The public identifier associated with the entity. If not specified,
214:             * this will be null. */
215:            public void setPublicId(String id) {
216:
217:                if (needsSyncData()) {
218:                    synchronizeData();
219:                }
220:                publicId = id;
221:
222:            } // setPublicId(String)
223:
224:            /**
225:             * NON-DOM 
226:             * encoding - An attribute specifying, as part of the text declaration, 
227:             * the encoding of this entity, when it is an external parsed entity. 
228:             * This is null otherwise
229:             *
230:             */
231:            public void setXmlEncoding(String value) {
232:                if (needsSyncData()) {
233:                    synchronizeData();
234:                }
235:                encoding = value;
236:            } // setEncoding (String)
237:
238:            /**
239:             * An attribute specifying the encoding used for this entity at the tiome 
240:             * of parsing, when it is an external parsed entity. This is 
241:             * <code>null</code> if it an entity from the internal subset or if it 
242:             * is not known..
243:             * @since DOM Level 3
244:             */
245:            public String getInputEncoding() {
246:                if (needsSyncData()) {
247:                    synchronizeData();
248:                }
249:                return inputEncoding;
250:            }
251:
252:            /**
253:             * NON-DOM, used to set the input encoding.
254:             */
255:            public void setInputEncoding(String inputEncoding) {
256:                if (needsSyncData()) {
257:                    synchronizeData();
258:                }
259:                this .inputEncoding = inputEncoding;
260:            }
261:
262:            /** 
263:             * NON-DOM
264:             * version - An attribute specifying, as part of the text declaration, 
265:             * the version number of this entity, when it is an external parsed entity. 
266:             * This is null otherwise
267:             */
268:            public void setXmlVersion(String value) {
269:                if (needsSyncData()) {
270:                    synchronizeData();
271:                }
272:                version = value;
273:            } // setVersion (String)
274:
275:            /**
276:             * DOM Level 2: The system identifier associated with the entity. If not
277:             * specified, this will be null. 
278:             */
279:            public void setSystemId(String id) {
280:                if (needsSyncData()) {
281:                    synchronizeData();
282:                }
283:                systemId = id;
284:
285:            } // setSystemId(String)
286:
287:            /** 
288:             * DOM Level 2: Unparsed entities -- which contain non-XML data -- have a
289:             * "notation name" which tells applications how to deal with them.
290:             * Parsed entities, which <em>are</em> in XML format, don't need this and
291:             * set it to null.  
292:             */
293:            public void setNotationName(String name) {
294:                if (needsSyncData()) {
295:                    synchronizeData();
296:                }
297:                notationName = name;
298:
299:            } // setNotationName(String)
300:
301:            /**
302:             * Returns the absolute base URI of this node or null if the implementation
303:             * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a
304:             * null is returned.
305:             * 
306:             * @return The absolute base URI of this node or null.
307:             * @since DOM Level 3
308:             */
309:            public String getBaseURI() {
310:
311:                if (needsSyncData()) {
312:                    synchronizeData();
313:                }
314:                return (baseURI != null) ? baseURI
315:                        : ((CoreDocumentImpl) getOwnerDocument()).getBaseURI();
316:            }
317:
318:            /** NON-DOM: set base uri*/
319:            public void setBaseURI(String uri) {
320:                if (needsSyncData()) {
321:                    synchronizeData();
322:                }
323:                baseURI = uri;
324:            }
325:
326:        } // class EntityImpl
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.