Source Code Cross Referenced for StAXResult.java in  » XML » stax-utils » javanet » staxutils » 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 » stax utils » javanet.staxutils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* $Id: StAXResult.java,v 1.2 2004/06/24 18:04:57 ryan_shoemaker Exp $
002:         *
003:         * Copyright (c) 2004, Sun Microsystems, Inc.
004:         * All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions are
008:         * met:
009:         *
010:         *     * Redistributions of source code must retain the above copyright
011:         *      notice, this list of conditions and the following disclaimer.
012:         *
013:         *     * Redistributions in binary form must reproduce the above
014:         *      copyright notice, this list of conditions and the following
015:         *       disclaimer in the documentation and/or other materials provided
016:         *       with the distribution.
017:         *
018:         *     * Neither the name of Sun Microsystems, Inc. nor the names of its
019:         *       contributors may be used to endorse or promote products derived
020:         *       from this software without specific prior written permission.
021:         *
022:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
023:         * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
024:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
025:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
026:         * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
027:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
028:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
029:         * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
030:         * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
031:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
032:         * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
033:         */
034:        package javanet.staxutils;
035:
036:        import javax.xml.stream.XMLEventWriter;
037:        import javax.xml.stream.XMLStreamWriter;
038:        import javax.xml.transform.sax.SAXResult;
039:
040:        /**
041:         * A JAXP {@link javax.xml.transform.Result} implementation that produces
042:         * a result on the specified {@link javax.xml.stream.XMLStreamWriter} or
043:         * {@link javax.xml.stream.XMLEventWriter}.
044:         *
045:         * <p>
046:         * Please note that you may need to call flush() on the underlying
047:         * XMLStreamWriter or XMLEventWriter after the transform is complete.
048:         * <p>
049:         * 
050:         * The fact that JAXBResult derives from SAXResult is an implementation
051:         * detail. Thus in general applications are strongly discouraged from
052:         * accessing methods defined on SAXResult.
053:         *
054:         * <p>
055:         * In particular it shall never attempt to call the following methods:
056:         *
057:         * <ul>
058:         *    <li>setHandler</li>
059:         *    <li>setLexicalHandler</li>
060:         *    <li>setSystemId</li>
061:         * </ul>
062:         *
063:         * <p>
064:         * Example:
065:         *
066:         * <pre>
067:         // create a DOMSource
068:         Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(...);
069:         Source domSource = new DOMSource(doc);
070:
071:         // create a StAXResult
072:         XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
073:         Result staxResult = new StAXResult(writer);
074:
075:         // run the transform
076:         TransformerFactory.newInstance().newTransformer().transform(domSource, staxResult);
077:         * </pre>
078:         *
079:         * @author Ryan.Shoemaker@Sun.COM
080:         * @version 1.0
081:         */
082:        public class StAXResult extends SAXResult {
083:
084:            /**
085:             * Create a new {@link javax.xml.transform.Result} that produces
086:             * a result on the specified {@link javax.xml.stream.XMLStreamWriter}
087:             *
088:             * @param writer the XMLStreamWriter
089:             * @throws IllegalArgumentException iff the writer is null
090:             */
091:            public StAXResult(XMLStreamWriter writer) {
092:                if (writer == null) {
093:                    throw new IllegalArgumentException();
094:                }
095:
096:                super .setHandler(new ContentHandlerToXMLStreamWriter(writer));
097:            }
098:
099:            /**
100:             * Create a new {@link javax.xml.transform.Result} that produces
101:             * a result on the specified {@link javax.xml.stream.XMLEventWriter}
102:             *
103:             * @param writer the XMLEventWriter
104:             * @throws IllegalArgumentException iff the writer is null
105:             */
106:            public StAXResult(XMLEventWriter writer) {
107:                if (writer == null) {
108:                    throw new IllegalArgumentException();
109:                }
110:
111:                super .setHandler(new ContentHandlerToXMLEventWriter(writer));
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.