Source Code Cross Referenced for JDOMTransform.java in  » XML » XPath-Saxon » net » sf » saxon » jdom » 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 » XPath Saxon » net.sf.saxon.jdom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package net.sf.saxon.jdom;
02:
03:        import net.sf.saxon.Transform;
04:        import net.sf.saxon.trans.DynamicError;
05:        import net.sf.saxon.trans.XPathException;
06:        import org.jdom.JDOMException;
07:        import org.jdom.input.SAXBuilder;
08:        import org.xml.sax.InputSource;
09:
10:        import javax.xml.transform.Source;
11:        import javax.xml.transform.sax.SAXSource;
12:        import javax.xml.transform.stream.StreamSource;
13:        import java.io.IOException;
14:        import java.util.ArrayList;
15:        import java.util.List;
16:
17:        /**
18:         * Variant of command line net.sf.saxon.Transform do build the source document
19:         * in JDOM and then proceed with the transformation. This class is provided largely for
20:         * testing purposes.
21:         */
22:
23:        public class JDOMTransform extends Transform {
24:
25:            public List preprocess(List sources) throws XPathException {
26:                try {
27:                    ArrayList jdomSources = new ArrayList(sources.size());
28:                    for (int i = 0; i < sources.size(); i++) {
29:                        Source src = (Source) sources.get(i);
30:                        InputSource is;
31:                        if (src instanceof  SAXSource) {
32:                            SAXSource ss = (SAXSource) sources.get(i);
33:                            is = ss.getInputSource();
34:                        } else if (src instanceof  StreamSource) {
35:                            StreamSource ss = (StreamSource) src;
36:                            if (ss.getInputStream() != null) {
37:                                is = new InputSource(ss.getInputStream());
38:                            } else if (ss.getReader() != null) {
39:                                is = new InputSource(ss.getReader());
40:                            } else {
41:                                is = new InputSource(ss.getSystemId());
42:                            }
43:                        } else {
44:                            throw new IllegalArgumentException(
45:                                    "Unknown kind of source");
46:                        }
47:                        is.setSystemId(src.getSystemId());
48:                        SAXBuilder builder = new SAXBuilder();
49:                        org.jdom.Document doc = builder.build(is);
50:                        DocumentWrapper jdom = new DocumentWrapper(doc, is
51:                                .getSystemId(), config);
52:                        jdomSources.add(jdom);
53:                    }
54:                    return jdomSources;
55:                } catch (JDOMException e) {
56:                    throw new DynamicError(e);
57:                } catch (IOException e) {
58:                    throw new DynamicError(e);
59:                }
60:            }
61:
62:            public static void main(String[] args) {
63:                new JDOMTransform().doMain(args, "JDOMTransform");
64:            }
65:        }
66:
67:        //
68:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
69:        // you may not use this file except in compliance with the License. You may obtain a copy of the
70:        // License at http://www.mozilla.org/MPL/
71:        //
72:        // Software distributed under the License is distributed on an "AS IS" basis,
73:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
74:        // See the License for the specific language governing rights and limitations under the License.
75:        //
76:        // The Original Code is: all this file.
77:        //
78:        // The Initial Developer of the Original Code is Michael H. Kay
79:        //
80:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
81:        //
82:        // Contributor(s): none
83:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.