Source Code Cross Referenced for SAXSource.java in  » Web-Server » Rimfaxe-Web-Server » javax » xml » transform » sax » 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 » javax.xml.transform.sax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: SAXSource.java,v 1.4 2001/11/02 22:07:45 db Exp $
003:         * Copyright (C) 2001 Andrew Selkirk
004:         * Copyright (C) 2001 David Brownell
005:         * 
006:         * This file is part of GNU JAXP, a library.
007:         *
008:         * GNU JAXP is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License as published by
010:         * the Free Software Foundation; either version 2 of the License, or
011:         * (at your option) any later version.
012:         * 
013:         * GNU JAXP is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         * 
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
021:         *
022:         * As a special exception, if you link this library with other files to
023:         * produce an executable, this library does not by itself cause the
024:         * resulting executable to be covered by the GNU General Public License.
025:         * This exception does not however invalidate any other reasons why the
026:         * executable file might be covered by the GNU General Public License. 
027:         */
028:        package javax.xml.transform.sax;
029:
030:        import org.xml.sax.XMLReader;
031:        import org.xml.sax.InputSource;
032:        import javax.xml.transform.Source;
033:        import javax.xml.transform.stream.StreamSource;
034:
035:        /**
036:         * Acts as a holder for "pull style" inputs to an XSLT transform.
037:         * SAX based transforms can support a second style of inputs,
038:         * driving by a {@link TransformerHandler} as output of some
039:         * other SAX processing pipeline. stage.
040:         *
041:         * @see SAXTransformerFactory#newTransformerHandler
042:         * 
043:         * @author	Andrew Selkirk, David Brownell
044:         * @version	1.0
045:         */
046:        public class SAXSource implements  Source {
047:            /**
048:             * Used with <em>TransformerFactory.getFeature()</em> to determine
049:             * whether the transformers it produces support SAXSource objects
050:             * (possibly without URIs) as inputs.
051:             */
052:            public static final String FEATURE = "http://javax.xml.transform.sax.SAXSource/feature";
053:
054:            private XMLReader reader = null;
055:            private InputSource inputSource = null;
056:
057:            //-------------------------------------------------------------
058:            // Initialization ---------------------------------------------
059:            //-------------------------------------------------------------
060:
061:            public SAXSource() {
062:            } // SAXSource()
063:
064:            public SAXSource(XMLReader reader, InputSource source) {
065:                this .reader = reader;
066:                this .inputSource = source;
067:            } // SAXSource()
068:
069:            public SAXSource(InputSource source) {
070:                this .inputSource = source;
071:            } // SAXSource()
072:
073:            //-------------------------------------------------------------
074:            // Methods ----------------------------------------------------
075:            //-------------------------------------------------------------
076:
077:            public void setXMLReader(XMLReader reader) {
078:                this .reader = reader;
079:            } // setXMLReader()
080:
081:            public XMLReader getXMLReader() {
082:                return reader;
083:            } // getXMLReader()
084:
085:            public void setInputSource(InputSource source) {
086:                this .inputSource = source;
087:            } // setInputSource()
088:
089:            public InputSource getInputSource() {
090:                return inputSource;
091:            } // inputSource()
092:
093:            public void setSystemId(String systemID) {
094:                if (inputSource != null) {
095:                    inputSource.setSystemId(systemID);
096:                }
097:            } // setSystemId()
098:
099:            public String getSystemId() {
100:                if (inputSource != null) {
101:                    return inputSource.getSystemId();
102:                } // if
103:                return null;
104:            } // getSystemId()
105:
106:            /**
107:             * Creates a SAX input source from its argument.
108:             * Understands StreamSource and System ID based input sources,
109:             * and insists on finding either a system ID (URI) or some kind
110:             * of input stream (character or byte).
111:             *
112:             * @param in TRAX style input source
113:             * @return SAX input source, or null if one could not be
114:             *	created.
115:             */
116:            public static InputSource sourceToInputSource(Source in) {
117:                InputSource retval;
118:                boolean ok = false;
119:
120:                if (in.getSystemId() != null) {
121:                    retval = new InputSource(in.getSystemId());
122:                    ok = true;
123:                } else
124:                    retval = new InputSource();
125:
126:                if (in instanceof  StreamSource) {
127:                    StreamSource ss = (StreamSource) in;
128:
129:                    if (ss.getReader() != null) {
130:                        retval.setCharacterStream(ss.getReader());
131:                        ok = true;
132:                    } else if (ss.getInputStream() != null) {
133:                        retval.setByteStream(ss.getInputStream());
134:                        ok = true;
135:                    }
136:                    if (ss.getPublicId() != null)
137:                        retval.setPublicId(ss.getPublicId());
138:                }
139:
140:                return ok ? retval : null;
141:            }
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.