Source Code Cross Referenced for DOMInputImpl.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.ls.LSInput;
021:
022:        import java.io.Reader;
023:        import java.io.InputStream;
024:
025:        /**
026:         * This Class <code>DOMInputImpl</code> represents a single input source for an XML entity.
027:         * <p> This Class allows an application to encapsulate information about
028:         * an input source in a single object, which may include a public
029:         * identifier, a system identifier, a byte stream (possibly with a specified
030:         * encoding), and/or a character stream.
031:         * <p> The exact definitions of a byte stream and a character stream are
032:         * binding dependent.
033:         * <p> There are two places that the application will deliver this input
034:         * source to the parser: as the argument to the <code>parse</code> method,
035:         * or as the return value of the <code>DOMResourceResolver.resolveEntity</code>
036:         *  method.
037:         * <p> The <code>DOMParser</code> will use the <code>LSInput</code>
038:         * object to determine how to read XML input. If there is a character stream
039:         * available, the parser will read that stream directly; if not, the parser
040:         * will use a byte stream, if available; if neither a character stream nor a
041:         * byte stream is available, the parser will attempt to open a URI
042:         * connection to the resource identified by the system identifier.
043:         * <p> An <code>LSInput</code> object belongs to the application: the
044:         * parser shall never modify it in any way (it may modify a copy if
045:         * necessary).  Eventhough all attributes in this interface are writable the
046:         * DOM implementation is expected to never mutate a LSInput.
047:         * <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
048:         and Save Specification</a>.
049:         *
050:         * @xerces.internal
051:         *
052:         * @author Gopal Sharma, SUN Microsystems Inc.
053:         * @version $Id: DOMInputImpl.java 447266 2006-09-18 05:57:49Z mrglavas $
054:         */
055:
056:        // REVISIT:
057:        // 1. it should be possible to do the following
058:        // DOMInputImpl extends XMLInputSource implements LSInput
059:        // 2. we probably need only the default constructor.  -- el
060:        public class DOMInputImpl implements  LSInput {
061:
062:            //
063:            // Data
064:            //
065:
066:            protected String fPublicId = null;
067:            protected String fSystemId = null;
068:            protected String fBaseSystemId = null;
069:
070:            protected InputStream fByteStream = null;
071:            protected Reader fCharStream = null;
072:            protected String fData = null;
073:
074:            protected String fEncoding = null;
075:
076:            protected boolean fCertifiedText = false;
077:
078:            /**
079:             * Default Constructor, constructs an input source
080:             *
081:             *
082:             */
083:            public DOMInputImpl() {
084:            }
085:
086:            /**
087:             * Constructs an input source from just the public and system
088:             * identifiers, leaving resolution of the entity and opening of
089:             * the input stream up to the caller.
090:             *
091:             * @param publicId     The public identifier, if known.
092:             * @param systemId     The system identifier. This value should
093:             *                     always be set, if possible, and can be
094:             *                     relative or absolute. If the system identifier
095:             *                     is relative, then the base system identifier
096:             *                     should be set.
097:             * @param baseSystemId The base system identifier. This value should
098:             *                     always be set to the fully expanded URI of the
099:             *                     base system identifier, if possible.
100:             */
101:
102:            public DOMInputImpl(String publicId, String systemId,
103:                    String baseSystemId) {
104:
105:                fPublicId = publicId;
106:                fSystemId = systemId;
107:                fBaseSystemId = baseSystemId;
108:
109:            } // DOMInputImpl(String,String,String)
110:
111:            /**
112:             * Constructs an input source from a byte stream.
113:             *
114:             * @param publicId     The public identifier, if known.
115:             * @param systemId     The system identifier. This value should
116:             *                     always be set, if possible, and can be
117:             *                     relative or absolute. If the system identifier
118:             *                     is relative, then the base system identifier
119:             *                     should be set.
120:             * @param baseSystemId The base system identifier. This value should
121:             *                     always be set to the fully expanded URI of the
122:             *                     base system identifier, if possible.
123:             * @param byteStream   The byte stream.
124:             * @param encoding     The encoding of the byte stream, if known.
125:             */
126:
127:            public DOMInputImpl(String publicId, String systemId,
128:                    String baseSystemId, InputStream byteStream, String encoding) {
129:
130:                fPublicId = publicId;
131:                fSystemId = systemId;
132:                fBaseSystemId = baseSystemId;
133:                fByteStream = byteStream;
134:                fEncoding = encoding;
135:
136:            } // DOMInputImpl(String,String,String,InputStream,String)
137:
138:            /**
139:             * Constructs an input source from a character stream.
140:             *
141:             * @param publicId     The public identifier, if known.
142:             * @param systemId     The system identifier. This value should
143:             *                     always be set, if possible, and can be
144:             *                     relative or absolute. If the system identifier
145:             *                     is relative, then the base system identifier
146:             *                     should be set.
147:             * @param baseSystemId The base system identifier. This value should
148:             *                     always be set to the fully expanded URI of the
149:             *                     base system identifier, if possible.
150:             * @param charStream   The character stream.
151:             * @param encoding     The original encoding of the byte stream
152:             *                     used by the reader, if known.
153:             */
154:
155:            public DOMInputImpl(String publicId, String systemId,
156:                    String baseSystemId, Reader charStream, String encoding) {
157:
158:                fPublicId = publicId;
159:                fSystemId = systemId;
160:                fBaseSystemId = baseSystemId;
161:                fCharStream = charStream;
162:                fEncoding = encoding;
163:
164:            } // DOMInputImpl(String,String,String,Reader,String)
165:
166:            /**
167:             * Constructs an input source from a String.
168:             *
169:             * @param publicId     The public identifier, if known.
170:             * @param systemId     The system identifier. This value should
171:             *                     always be set, if possible, and can be
172:             *                     relative or absolute. If the system identifier
173:             *                     is relative, then the base system identifier
174:             *                     should be set.
175:             * @param baseSystemId The base system identifier. This value should
176:             *                     always be set to the fully expanded URI of the
177:             *                     base system identifier, if possible.
178:             * @param data		   The String Data.
179:             * @param encoding     The original encoding of the byte stream
180:             *                     used by the reader, if known.
181:             */
182:
183:            public DOMInputImpl(String publicId, String systemId,
184:                    String baseSystemId, String data, String encoding) {
185:                fPublicId = publicId;
186:                fSystemId = systemId;
187:                fBaseSystemId = baseSystemId;
188:                fData = data;
189:                fEncoding = encoding;
190:            } // DOMInputImpl(String,String,String,String,String)
191:
192:            /**
193:             * An attribute of a language-binding dependent type that represents a
194:             * stream of bytes.
195:             * <br>The parser will ignore this if there is also a character stream
196:             * specified, but it will use a byte stream in preference to opening a
197:             * URI connection itself.
198:             * <br>If the application knows the character encoding of the byte stream,
199:             * it should set the encoding property. Setting the encoding in this way
200:             * will override any encoding specified in the XML declaration itself.
201:             */
202:
203:            public InputStream getByteStream() {
204:                return fByteStream;
205:            }
206:
207:            /**
208:             * An attribute of a language-binding dependent type that represents a
209:             * stream of bytes.
210:             * <br>The parser will ignore this if there is also a character stream
211:             * specified, but it will use a byte stream in preference to opening a
212:             * URI connection itself.
213:             * <br>If the application knows the character encoding of the byte stream,
214:             * it should set the encoding property. Setting the encoding in this way
215:             * will override any encoding specified in the XML declaration itself.
216:             */
217:
218:            public void setByteStream(InputStream byteStream) {
219:                fByteStream = byteStream;
220:            }
221:
222:            /**
223:             *  An attribute of a language-binding dependent type that represents a
224:             * stream of 16-bit units. Application must encode the stream using
225:             * UTF-16 (defined in  and Amendment 1 of ).
226:             * <br>If a character stream is specified, the parser will ignore any byte
227:             * stream and will not attempt to open a URI connection to the system
228:             * identifier.
229:             */
230:            public Reader getCharacterStream() {
231:                return fCharStream;
232:            }
233:
234:            /**
235:             *  An attribute of a language-binding dependent type that represents a
236:             * stream of 16-bit units. Application must encode the stream using
237:             * UTF-16 (defined in  and Amendment 1 of ).
238:             * <br>If a character stream is specified, the parser will ignore any byte
239:             * stream and will not attempt to open a URI connection to the system
240:             * identifier.
241:             */
242:
243:            public void setCharacterStream(Reader characterStream) {
244:                fCharStream = characterStream;
245:            }
246:
247:            /**
248:             * A string attribute that represents a sequence of 16 bit units (utf-16
249:             * encoded characters).
250:             * <br>If string data is available in the input source, the parser will
251:             * ignore the character stream and the byte stream and will not attempt
252:             * to open a URI connection to the system identifier.
253:             */
254:            public String getStringData() {
255:                return fData;
256:            }
257:
258:            /**
259:             * A string attribute that represents a sequence of 16 bit units (utf-16
260:             * encoded characters).
261:             * <br>If string data is available in the input source, the parser will
262:             * ignore the character stream and the byte stream and will not attempt
263:             * to open a URI connection to the system identifier.
264:             */
265:
266:            public void setStringData(String stringData) {
267:                fData = stringData;
268:            }
269:
270:            /**
271:             *  The character encoding, if known. The encoding must be a string
272:             * acceptable for an XML encoding declaration ( section 4.3.3 "Character
273:             * Encoding in Entities").
274:             * <br>This attribute has no effect when the application provides a
275:             * character stream. For other sources of input, an encoding specified
276:             * by means of this attribute will override any encoding specified in
277:             * the XML claration or the Text Declaration, or an encoding obtained
278:             * from a higher level protocol, such as HTTP .
279:             */
280:
281:            public String getEncoding() {
282:                return fEncoding;
283:            }
284:
285:            /**
286:             *  The character encoding, if known. The encoding must be a string
287:             * acceptable for an XML encoding declaration ( section 4.3.3 "Character
288:             * Encoding in Entities").
289:             * <br>This attribute has no effect when the application provides a
290:             * character stream. For other sources of input, an encoding specified
291:             * by means of this attribute will override any encoding specified in
292:             * the XML claration or the Text Declaration, or an encoding obtained
293:             * from a higher level protocol, such as HTTP .
294:             */
295:            public void setEncoding(String encoding) {
296:                fEncoding = encoding;
297:            }
298:
299:            /**
300:             * The public identifier for this input source. The public identifier is
301:             * always optional: if the application writer includes one, it will be
302:             * provided as part of the location information.
303:             */
304:            public String getPublicId() {
305:                return fPublicId;
306:            }
307:
308:            /**
309:             * The public identifier for this input source. The public identifier is
310:             * always optional: if the application writer includes one, it will be
311:             * provided as part of the location information.
312:             */
313:            public void setPublicId(String publicId) {
314:                fPublicId = publicId;
315:            }
316:
317:            /**
318:             * The system identifier, a URI reference , for this input source. The
319:             * system identifier is optional if there is a byte stream or a
320:             * character stream, but it is still useful to provide one, since the
321:             * application can use it to resolve relative URIs and can include it in
322:             * error messages and warnings (the parser will attempt to fetch the
323:             * ressource identifier by the URI reference only if there is no byte
324:             * stream or character stream specified).
325:             * <br>If the application knows the character encoding of the object
326:             * pointed to by the system identifier, it can register the encoding by
327:             * setting the encoding attribute.
328:             * <br>If the system ID is a relative URI reference (see section 5 in ),
329:             * the behavior is implementation dependent.
330:             */
331:            public String getSystemId() {
332:                return fSystemId;
333:            }
334:
335:            /**
336:             * The system identifier, a URI reference , for this input source. The
337:             * system identifier is optional if there is a byte stream or a
338:             * character stream, but it is still useful to provide one, since the
339:             * application can use it to resolve relative URIs and can include it in
340:             * error messages and warnings (the parser will attempt to fetch the
341:             * ressource identifier by the URI reference only if there is no byte
342:             * stream or character stream specified).
343:             * <br>If the application knows the character encoding of the object
344:             * pointed to by the system identifier, it can register the encoding by
345:             * setting the encoding attribute.
346:             * <br>If the system ID is a relative URI reference (see section 5 in ),
347:             * the behavior is implementation dependent.
348:             */
349:            public void setSystemId(String systemId) {
350:                fSystemId = systemId;
351:            }
352:
353:            /**
354:             *  The base URI to be used (see section 5.1.4 in ) for resolving relative
355:             * URIs to absolute URIs. If the baseURI is itself a relative URI, the
356:             * behavior is implementation dependent.
357:             */
358:            public String getBaseURI() {
359:                return fBaseSystemId;
360:            }
361:
362:            /**
363:             *  The base URI to be used (see section 5.1.4 in ) for resolving relative
364:             * URIs to absolute URIs. If the baseURI is itself a relative URI, the
365:             * behavior is implementation dependent.
366:             */
367:            public void setBaseURI(String baseURI) {
368:                fBaseSystemId = baseURI;
369:            }
370:
371:            /**
372:             *  If set to true, assume that the input is certified (see section 2.13
373:             * in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>]) when
374:             * parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>].
375:             */
376:            public boolean getCertifiedText() {
377:                return fCertifiedText;
378:            }
379:
380:            /**
381:             *  If set to true, assume that the input is certified (see section 2.13
382:             * in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>]) when
383:             * parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>].
384:             */
385:
386:            public void setCertifiedText(boolean certifiedText) {
387:                fCertifiedText = certifiedText;
388:            }
389:
390:        }// class DOMInputImpl
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.