Source Code Cross Referenced for XMLOutputFactory.java in  » 6.0-JDK-Core » xml » javax » xml » stream » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.stream 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        package javax.xml.stream;
002
003        import javax.xml.transform.Result;
004
005        /**
006         * Defines an abstract implementation of a factory for 
007         * getting XMLEventWriters and XMLStreamWriters.
008         *
009         * The following table defines the standard properties of this specification.  
010         * Each property varies in the level of support required by each implementation.
011         * The level of support required is described in the 'Required' column.
012         *
013         *     <table border="2" rules="all" cellpadding="4">
014         *     <thead>
015         *      <tr>
016         *        <th align="center" colspan="2">
017         *          Configuration parameters
018         *        </th>
019         *      </tr>
020         *    </thead>
021         *    <tbody>
022         *      <tr>
023         *        <th>Property Name</th>
024         *        <th>Behavior</th>
025         *        <th>Return type</th>
026         *        <th>Default Value</th>
027         *        <th>Required</th>
028         *              </tr>
029         *         <tr><td>javax.xml.stream.isRepairingNamespaces</td><td>defaults prefixes on the output side</td><td>Boolean</td><td>False</td><td>Yes</td></tr>
030         *      </tbody>
031         *   </table>
032         *
033         * <p>The following paragraphs describe the namespace and prefix repair algorithm:</p>
034         *
035         * <p>The property can be set with the following code line:
036         * <code>setProperty("javax.xml.stream.isRepairingNamespaces",new Boolean(true|false));</code></p>
037         * 
038         * <p>This property specifies that the writer default namespace prefix declarations. 
039         * The default value is false. </p>
040         *
041         * <p>If a writer isRepairingNamespaces it will create a namespace declaration
042         * on the current StartElement for
043         * any attribute that does not 
044         * currently have a namespace declaration in scope.  If the StartElement
045         * has a uri but no prefix specified a prefix will be assigned, if the prefix
046         * has not been declared in a parent of the current StartElement it will be declared
047         * on the current StartElement.  If the defaultNamespace is bound and in scope
048         * and the default namespace matches the URI of the attribute or StartElement
049         * QName no prefix will be assigned.</p>
050         *
051         * <p>If an element or attribute name has a prefix, but is not 
052         * bound to any namespace URI, then the prefix will be removed 
053         * during serialization.</p> 
054         *
055         * <p>If element and/or attribute names in the same start or 
056         * empty-element tag are bound to different namespace URIs and 
057         * are using the same prefix then the element or the first 
058         * occurring attribute retains the original prefix and the 
059         * following attributes have their prefixes replaced with a 
060         * new prefix that is bound to the namespace URIs of those 
061         * attributes. </p>
062         *
063         * <p>If an element or attribute name uses a prefix that is 
064         * bound to a different URI than that inherited from the 
065         * namespace context of the parent of that element and there 
066         * is no namespace declaration in the context of the current 
067         * element then such a namespace declaration is added. </p>
068         *
069         * <p>If an element or attribute name is bound to a prefix and 
070         * there is a namespace declaration that binds that prefix 
071         * to a different URI then that namespace declaration is 
072         * either removed if the correct mapping is inherited from 
073         * the parent context of that element, or changed to the 
074         * namespace URI of the element or attribute using that prefix.</p> 
075         *
076         * @version 1.0 
077         * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
078         * @see XMLInputFactory
079         * @see XMLEventWriter
080         * @see XMLStreamWriter
081         * @since 1.6
082         */
083        public abstract class XMLOutputFactory {
084            /** 
085             * Property used to set prefix defaulting on the output side 
086             */
087            public static final String IS_REPAIRING_NAMESPACES = "javax.xml.stream.isRepairingNamespaces";
088
089            protected XMLOutputFactory() {
090            }
091
092            /**
093             * Create a new instance of the factory.
094             * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
095             */
096            public static XMLOutputFactory newInstance()
097                    throws FactoryConfigurationError {
098                return (XMLOutputFactory) FactoryFinder.find(
099                        "javax.xml.stream.XMLOutputFactory",
100                        "com.sun.xml.internal.stream.XMLOutputFactoryImpl");
101            }
102
103            /**
104             * Create a new instance of the factory. 
105             *
106             * @param factoryId             Name of the factory to find, same as
107             *                              a property name
108             * @param classLoader           classLoader to use
109             * @return the factory implementation
110             * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
111             */
112            public static XMLInputFactory newInstance(String factoryId,
113                    ClassLoader classLoader) throws FactoryConfigurationError {
114                try {
115                    //do not fallback if given classloader can't find the class, throw exception
116                    return (XMLInputFactory) FactoryFinder.newInstance(
117                            factoryId, classLoader, false);
118                } catch (FactoryFinder.ConfigurationError e) {
119                    throw new FactoryConfigurationError(e.getException(), e
120                            .getMessage());
121                }
122            }
123
124            /**
125             * Create a new XMLStreamWriter that writes to a writer
126             * @param stream the writer to write to
127             * @throws XMLStreamException
128             */
129            public abstract XMLStreamWriter createXMLStreamWriter(
130                    java.io.Writer stream) throws XMLStreamException;
131
132            /**
133             * Create a new XMLStreamWriter that writes to a stream
134             * @param stream the stream to write to
135             * @throws XMLStreamException
136             */
137            public abstract XMLStreamWriter createXMLStreamWriter(
138                    java.io.OutputStream stream) throws XMLStreamException;
139
140            /**
141             * Create a new XMLStreamWriter that writes to a stream
142             * @param stream the stream to write to
143             * @param encoding the encoding to use
144             * @throws XMLStreamException
145             */
146            public abstract XMLStreamWriter createXMLStreamWriter(
147                    java.io.OutputStream stream, String encoding)
148                    throws XMLStreamException;
149
150            /**
151             * Create a new XMLStreamWriter that writes to a JAXP result.  This method is optional.
152             * @param result the result to write to
153             * @throws UnsupportedOperationException if this method is not 
154             * supported by this XMLOutputFactory
155             * @throws XMLStreamException 
156             */
157            public abstract XMLStreamWriter createXMLStreamWriter(Result result)
158                    throws XMLStreamException;
159
160            /**
161             * Create a new XMLEventWriter that writes to a JAXP result.  This method is optional.
162             * @param result the result to write to
163             * @throws UnsupportedOperationException if this method is not 
164             * supported by this XMLOutputFactory
165             * @throws XMLStreamException 
166             */
167            public abstract XMLEventWriter createXMLEventWriter(Result result)
168                    throws XMLStreamException;
169
170            /**
171             * Create a new XMLEventWriter that writes to a stream
172             * @param stream the stream to write to
173             * @throws XMLStreamException
174             */
175            public abstract XMLEventWriter createXMLEventWriter(
176                    java.io.OutputStream stream) throws XMLStreamException;
177
178            /**
179             * Create a new XMLEventWriter that writes to a stream
180             * @param stream the stream to write to
181             * @param encoding the encoding to use
182             * @throws XMLStreamException
183             */
184            public abstract XMLEventWriter createXMLEventWriter(
185                    java.io.OutputStream stream, String encoding)
186                    throws XMLStreamException;
187
188            /**
189             * Create a new XMLEventWriter that writes to a writer
190             * @param stream the stream to write to
191             * @throws XMLStreamException
192             */
193            public abstract XMLEventWriter createXMLEventWriter(
194                    java.io.Writer stream) throws XMLStreamException;
195
196            /**
197             * Allows the user to set specific features/properties on the underlying implementation. 
198             * @param name The name of the property
199             * @param value The value of the property
200             * @throws java.lang.IllegalArgumentException if the property is not supported
201             */
202            public abstract void setProperty(java.lang.String name, Object value)
203                    throws IllegalArgumentException;
204
205            /**
206             * Get a feature/property on the underlying implementation
207             * @param name The name of the property
208             * @return The value of the property
209             * @throws java.lang.IllegalArgumentException if the property is not supported
210             */
211            public abstract Object getProperty(java.lang.String name)
212                    throws IllegalArgumentException;
213
214            /**
215             * Query the set of properties that this factory supports.
216             *
217             * @param name The name of the property (may not be null)
218             * @return true if the property is supported and false otherwise
219             */
220            public abstract boolean isPropertySupported(String name);
221        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.