Source Code Cross Referenced for StaxSource.java in  » Web-Services » spring-ws-1.0.0 » org » springframework » xml » transform » 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 Services » spring ws 1.0.0 » org.springframework.xml.transform 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.xml.transform;
018:
019:        import javax.xml.stream.XMLEventReader;
020:        import javax.xml.stream.XMLStreamReader;
021:        import javax.xml.transform.sax.SAXSource;
022:
023:        import org.springframework.xml.stream.StaxEventXmlReader;
024:        import org.springframework.xml.stream.StaxStreamXmlReader;
025:        import org.xml.sax.InputSource;
026:        import org.xml.sax.XMLReader;
027:
028:        /**
029:         * Implementation of the <code>Source</code> tagging interface for StAX readers. Can be constructed with a
030:         * <code>XMLEventReader</code> or a <code>XMLStreamReader</code>.
031:         * <p/>
032:         * This class is necessary because there is no implementation of <code>Source</code> for StaxReaders in JAXP 1.3. There
033:         * will be a <code>StaxSource</code> in JAXP 1.4 (JDK 1.6), and by the time that version is available, this class will
034:         * probably be deprecated.
035:         * <p/>
036:         * Even though <code>StaxSource</code> extends from <code>SAXSource</code>, calling the methods of
037:         * <code>SAXSource</code> is <strong>not supported</strong>. In general, the only supported operation on this class is
038:         * to use the <code>XMLReader</code> obtained via {@link #getXMLReader()} to parse the input source obtained via {@link
039:         * #getInputSource()}. Calling {@link #setXMLReader(org.xml.sax.XMLReader)} or {@link
040:         * #setInputSource(org.xml.sax.InputSource)} will result in <code>UnsupportedOperationException</code>s.
041:         *
042:         * @author Arjen Poutsma
043:         * @see XMLEventReader
044:         * @see XMLStreamReader
045:         * @see javax.xml.transform.Transformer
046:         * @since 1.0.0
047:         */
048:        public class StaxSource extends SAXSource {
049:
050:            private XMLEventReader eventReader;
051:
052:            private XMLStreamReader streamReader;
053:
054:            /**
055:             * Constructs a new instance of the <code>StaxSource</code> with the specified <code>XMLStreamReader</code>. The
056:             * supplied stream reader must be in <code>XMLStreamConstants.START_DOCUMENT</code> or
057:             * <code>XMLStreamConstants.START_ELEMENT</code> state.
058:             *
059:             * @param streamReader the <code>XMLStreamReader</code> to read from
060:             * @throws IllegalStateException if the reader is not at the start of a document or element
061:             */
062:            public StaxSource(XMLStreamReader streamReader) {
063:                super (new StaxStreamXmlReader(streamReader), new InputSource());
064:                this .streamReader = streamReader;
065:            }
066:
067:            /**
068:             * Constructs a new instance of the <code>StaxSource</code> with the specified <code>XMLEventReader</code>. The
069:             * supplied event reader must be in <code>XMLStreamConstants.START_DOCUMENT</code> or
070:             * <code>XMLStreamConstants.START_ELEMENT</code> state.
071:             *
072:             * @param eventReader the <code>XMLEventReader</code> to read from
073:             * @throws IllegalStateException if the reader is not at the start of a document or element
074:             */
075:            public StaxSource(XMLEventReader eventReader) {
076:                super (new StaxEventXmlReader(eventReader), new InputSource());
077:                this .eventReader = eventReader;
078:            }
079:
080:            /**
081:             * Returns the <code>XMLEventReader</code> used by this <code>StaxSource</code>. If this <code>StaxSource</code> was
082:             * created with an <code>XMLStreamReader</code>, the result will be <code>null</code>.
083:             *
084:             * @return the StAX event reader used by this source
085:             * @see StaxSource#StaxSource(javax.xml.stream.XMLEventReader)
086:             */
087:            public XMLEventReader getXMLEventReader() {
088:                return eventReader;
089:            }
090:
091:            /**
092:             * Returns the <code>XMLStreamReader</code> used by this <code>StaxSource</code>. If this <code>StaxSource</code>
093:             * was created with an <code>XMLEventReader</code>, the result will be <code>null</code>.
094:             *
095:             * @return the StAX event reader used by this source
096:             * @see StaxSource#StaxSource(javax.xml.stream.XMLEventReader)
097:             */
098:            public XMLStreamReader getXMLStreamReader() {
099:                return streamReader;
100:            }
101:
102:            /**
103:             * Throws a <code>UnsupportedOperationException</code>.
104:             *
105:             * @throws UnsupportedOperationException always
106:             */
107:            public void setInputSource(InputSource inputSource) {
108:                throw new UnsupportedOperationException(
109:                        "setInputSource is not supported");
110:            }
111:
112:            /**
113:             * Throws a <code>UnsupportedOperationException</code>.
114:             *
115:             * @throws UnsupportedOperationException always
116:             */
117:            public void setXMLReader(XMLReader reader) {
118:                throw new UnsupportedOperationException(
119:                        "setXMLReader is not supported");
120:            }
121:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.