Import upstream version 1.4.01
Debian Janitor
2 years ago
0 | xml-commons/java/external/LICENSE.dom-software.txt $Id: LICENSE.dom-software.txt 734315 2009-01-14 03:33:42Z mrglavas $ | |
0 | xml-commons/java/external/LICENSE.dom-software.txt $Id: LICENSE.dom-software.txt 734314 2009-01-14 03:33:27Z mrglavas $ | |
1 | 1 | |
2 | 2 | This license came from: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.zip (COPYRIGHT.html) |
3 | 3 |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | //$Id: DatatypeFactory.java 759805 2009-03-30 00:31:41Z mrglavas $ | |
17 | //$Id: DatatypeFactory.java 884950 2009-11-27 18:46:18Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.datatype; |
20 | 20 | |
51 | 51 | * |
52 | 52 | * @author <a href="mailto:Joseph.Fialli@Sun.COM">Joseph Fialli</a> |
53 | 53 | * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> |
54 | * @version $Revision: 759805 $, $Date: 2009-03-29 20:31:41 -0400 (Sun, 29 Mar 2009) $ | |
54 | * @version $Revision: 884950 $, $Date: 2009-11-27 13:46:18 -0500 (Fri, 27 Nov 2009) $ | |
55 | 55 | * @since 1.5 |
56 | 56 | */ |
57 | 57 | public abstract class DatatypeFactory { |
68 | 68 | * |
69 | 69 | * <p>Default value is <code>org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl</code>.</p> |
70 | 70 | */ |
71 | public static final String DATATYPEFACTORY_IMPLEMENTATION_CLASS = "org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl"; | |
71 | public static final String DATATYPEFACTORY_IMPLEMENTATION_CLASS = new String("org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl"); | |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * <p>Protected constructor to prevent instantiation outside of package.</p> |
90 | 90 | */ |
91 | 91 | public static DatatypeFactory newInstance() |
92 | 92 | throws DatatypeConfigurationException { |
93 | ||
94 | 93 | try { |
95 | 94 | return (DatatypeFactory) FactoryFinder.find( |
96 | 95 | /* The default property name according to the JAXP spec */ |
98 | 97 | /* The fallback implementation class name */ |
99 | 98 | DATATYPEFACTORY_IMPLEMENTATION_CLASS); |
100 | 99 | } |
100 | catch (FactoryFinder.ConfigurationError e) { | |
101 | throw new DatatypeConfigurationException(e.getMessage(), e.getException()); | |
102 | } | |
103 | } | |
104 | ||
105 | /** | |
106 | * @return New instance of a <code>DocumentBuilderFactory</code> | |
107 | * | |
108 | * @throws DatatypeConfigurationException If the implementation is not | |
109 | * available or cannot be instantiated. | |
110 | */ | |
111 | public static DatatypeFactory newInstance(String factoryClassName, | |
112 | ClassLoader classLoader) throws DatatypeConfigurationException { | |
113 | if (factoryClassName == null) { | |
114 | throw new DatatypeConfigurationException("factoryClassName cannot be null."); | |
115 | } | |
116 | if (classLoader == null) { | |
117 | classLoader = SecuritySupport.getContextClassLoader(); | |
118 | } | |
119 | try { | |
120 | return (DatatypeFactory) FactoryFinder.newInstance(factoryClassName, classLoader); | |
121 | } | |
101 | 122 | catch (FactoryFinder.ConfigurationError e) { |
102 | 123 | throw new DatatypeConfigurationException(e.getMessage(), e.getException()); |
103 | 124 | } |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | //$Id: Duration.java 759827 2009-03-30 01:26:10Z mrglavas $ | |
17 | //$Id: Duration.java 759828 2009-03-30 01:26:29Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.datatype; |
20 | 20 | |
86 | 86 | * @author <a href="mailto:Joseph.Fialli@Sun.COM">Joseph Fialli</a> |
87 | 87 | * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
88 | 88 | * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> |
89 | * @version $Revision: 759827 $, $Date: 2009-03-29 21:26:10 -0400 (Sun, 29 Mar 2009) $ | |
89 | * @version $Revision: 759828 $, $Date: 2009-03-29 21:26:29 -0400 (Sun, 29 Mar 2009) $ | |
90 | 90 | * @see XMLGregorianCalendar#add(Duration) |
91 | 91 | * @since 1.5 |
92 | 92 | */ |
844 | 844 | * <code>true</code> if this duration is the same length as |
845 | 845 | * <code>duration</code>. |
846 | 846 | * <code>false</code> if <code>duration</code> is not a |
847 | * <code>Duration</code> object | |
847 | * <code>Duration</code> object, is <code>null</code>, | |
848 | 848 | * or its length is different from this duration. |
849 | 849 | * |
850 | 850 | * @throws UnsupportedOperationException If the underlying implementation |
851 | 851 | * cannot reasonably process the request, e.g. W3C XML Schema allows for |
852 | 852 | * arbitrarily large/small/precise values, the request may be beyond the |
853 | 853 | * implementations capability. |
854 | * @throws NullPointerException if parameter is null. | |
855 | 854 | * |
856 | 855 | * @see #compare(Duration duration) |
857 | 856 | */ |
858 | 857 | public boolean equals(final Object duration) { |
859 | 858 | if (duration == this) { |
860 | 859 | return true; |
861 | } | |
862 | if (duration == null) { | |
863 | throw new NullPointerException(); | |
864 | 860 | } |
865 | 861 | if (duration instanceof Duration) { |
866 | 862 | return compare((Duration) duration) == DatatypeConstants.EQUAL; |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: FactoryFinder.java 670433 2008-06-23 02:02:24Z mrglavas $ | |
17 | // $Id: FactoryFinder.java 670432 2008-06-23 02:02:08Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.datatype; |
20 | 20 | |
33 | 33 | * sync. It is package private for secure class loading.</p> |
34 | 34 | * |
35 | 35 | * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> |
36 | * @version $Revision: 670433 $, $Date: 2008-06-22 22:02:24 -0400 (Sun, 22 Jun 2008) $ | |
36 | * @version $Revision: 670432 $, $Date: 2008-06-22 22:02:08 -0400 (Sun, 22 Jun 2008) $ | |
37 | 37 | * @since 1.5 |
38 | 38 | */ |
39 | 39 | final class FactoryFinder { |
140 | 140 | * |
141 | 141 | * @throws ConfigurationError If class could not be created. |
142 | 142 | */ |
143 | private static Object newInstance( | |
143 | static Object newInstance( | |
144 | 144 | String className, |
145 | 145 | ClassLoader classLoader) |
146 | 146 | throws ConfigurationError { |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: XMLGregorianCalendar.java 759820 2009-03-30 01:14:57Z mrglavas $ | |
17 | // $Id: XMLGregorianCalendar.java 759822 2009-03-30 01:15:11Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.datatype; |
20 | 20 | |
168 | 168 | * @author <a href="mailto:Joseph.Fialli@Sun.com">Joseph Fialli</a> |
169 | 169 | * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
170 | 170 | * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> |
171 | * @version $Revision: 759820 $, $Date: 2009-03-29 21:14:57 -0400 (Sun, 29 Mar 2009) $ | |
171 | * @version $Revision: 759822 $, $Date: 2009-03-29 21:15:11 -0400 (Sun, 29 Mar 2009) $ | |
172 | 172 | * @see Duration |
173 | 173 | * @see DatatypeFactory |
174 | 174 | * @since 1.5 |
657 | 657 | * |
658 | 658 | * @return <code>true</code> when <code>obj</code> is an instance of <code>XMLGregorianCalendar</code> |
659 | 659 | * and {@link #compare(XMLGregorianCalendar obj)} returns {@link DatatypeConstants#EQUAL}, otherwise <code>false</code>. |
660 | * | |
661 | * @throws NullPointerException If <code>obj</code> is <code>null</code>. | |
662 | 660 | */ |
663 | 661 | public boolean equals(Object obj) { |
664 | 662 | if (obj == this) { |
665 | 663 | return true; |
666 | } | |
667 | if (obj == null) { | |
668 | throw new NullPointerException("Cannot test null for equality with this XMLGregorianCalendar"); | |
669 | 664 | } |
670 | 665 | if (obj instanceof XMLGregorianCalendar) { |
671 | 666 | return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL; |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: QName.java 754580 2009-03-15 01:32:01Z mrglavas $ | |
17 | // $Id: QName.java 754581 2009-03-15 01:32:39Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.namespace; |
20 | 20 | |
57 | 57 | * <p><code>QName</code> is immutable.</p> |
58 | 58 | * |
59 | 59 | * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> |
60 | * @version $Revision: 754580 $, $Date: 2009-03-14 21:32:01 -0400 (Sat, 14 Mar 2009) $ | |
60 | * @version $Revision: 754581 $, $Date: 2009-03-14 21:32:39 -0400 (Sat, 14 Mar 2009) $ | |
61 | 61 | * @see <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML Schema Part2: Datatypes specification</a> |
62 | 62 | * @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">Namespaces in XML</a> |
63 | 63 | * @see <a href="http://www.w3.org/XML/xml-names-19990114-errata">Namespaces in XML Errata</a> |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: DocumentBuilderFactory.java 569979 2007-08-27 03:57:11Z mrglavas $ | |
17 | // $Id: DocumentBuilderFactory.java 884950 2009-11-27 18:46:18Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.parsers; |
20 | 20 | |
25 | 25 | * parser that produces DOM object trees from XML documents. |
26 | 26 | * |
27 | 27 | * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a> |
28 | * @version $Revision: 569979 $, $Date: 2007-08-26 23:57:11 -0400 (Sun, 26 Aug 2007) $ | |
28 | * @version $Revision: 884950 $, $Date: 2009-11-27 13:46:18 -0500 (Fri, 27 Nov 2009) $ | |
29 | 29 | */ |
30 | 30 | |
31 | 31 | public abstract class DocumentBuilderFactory { |
104 | 104 | "javax.xml.parsers.DocumentBuilderFactory", |
105 | 105 | /* The fallback implementation class name */ |
106 | 106 | "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); |
107 | } catch (FactoryFinder.ConfigurationError e) { | |
108 | throw new FactoryConfigurationError(e.getException(), | |
109 | e.getMessage()); | |
107 | } | |
108 | catch (FactoryFinder.ConfigurationError e) { | |
109 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
110 | 110 | } |
111 | ||
111 | } | |
112 | ||
113 | /** | |
114 | * @return New instance of a <code>DocumentBuilderFactory</code> | |
115 | * | |
116 | * @exception FactoryConfigurationError if the implementation is not | |
117 | * available or cannot be instantiated. | |
118 | */ | |
119 | public static DocumentBuilderFactory newInstance(String factoryClassName, | |
120 | ClassLoader classLoader) { | |
121 | if (factoryClassName == null) { | |
122 | throw new FactoryConfigurationError("factoryClassName cannot be null."); | |
123 | } | |
124 | if (classLoader == null) { | |
125 | classLoader = SecuritySupport.getContextClassLoader(); | |
126 | } | |
127 | try { | |
128 | return (DocumentBuilderFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); | |
129 | } | |
130 | catch (FactoryFinder.ConfigurationError e) { | |
131 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
132 | } | |
112 | 133 | } |
113 | 134 | |
114 | 135 | /** |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: FactoryFinder.java 670293 2008-06-22 01:34:02Z mrglavas $ | |
17 | // $Id: FactoryFinder.java 670431 2008-06-23 01:40:03Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.parsers; |
20 | 20 | |
92 | 92 | * @param doFallback true if the current ClassLoader should be tried as |
93 | 93 | * a fallback if the class is not found using cl |
94 | 94 | */ |
95 | private static Object newInstance(String className, ClassLoader cl, | |
95 | static Object newInstance(String className, ClassLoader cl, | |
96 | 96 | boolean doFallback) |
97 | 97 | throws ConfigurationError |
98 | 98 | { |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: SAXParserFactory.java 569979 2007-08-27 03:57:11Z mrglavas $ | |
17 | // $Id: SAXParserFactory.java 884950 2009-11-27 18:46:18Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.parsers; |
20 | 20 | |
29 | 29 | * obtain a SAX based parser to parse XML documents. |
30 | 30 | * |
31 | 31 | * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a> |
32 | * @version $Revision: 569979 $, $Date: 2007-08-26 23:57:11 -0400 (Sun, 26 Aug 2007) $ | |
32 | * @version $Revision: 884950 $, $Date: 2009-11-27 13:46:18 -0500 (Fri, 27 Nov 2009) $ | |
33 | 33 | */ |
34 | 34 | public abstract class SAXParserFactory { |
35 | 35 | |
116 | 116 | "javax.xml.parsers.SAXParserFactory", |
117 | 117 | /* The fallback implementation class name */ |
118 | 118 | "org.apache.xerces.jaxp.SAXParserFactoryImpl"); |
119 | } catch (FactoryFinder.ConfigurationError e) { | |
120 | throw new FactoryConfigurationError(e.getException(), | |
121 | e.getMessage()); | |
119 | } | |
120 | catch (FactoryFinder.ConfigurationError e) { | |
121 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
122 | } | |
123 | } | |
124 | ||
125 | /** | |
126 | * @return A new instance of a SAXParserFactory. | |
127 | * | |
128 | * @exception FactoryConfigurationError if the implementation is | |
129 | * not available or cannot be instantiated. | |
130 | */ | |
131 | public static SAXParserFactory newInstance(String factoryClassName, | |
132 | ClassLoader classLoader) { | |
133 | if (factoryClassName == null) { | |
134 | throw new FactoryConfigurationError("factoryClassName cannot be null."); | |
135 | } | |
136 | if (classLoader == null) { | |
137 | classLoader = SecuritySupport.getContextClassLoader(); | |
138 | } | |
139 | try { | |
140 | return (SAXParserFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); | |
141 | } | |
142 | catch (FactoryFinder.ConfigurationError e) { | |
143 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
122 | 144 | } |
123 | 145 | } |
124 | 146 |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: SecuritySupport.java 670291 2008-06-22 01:30:16Z mrglavas $ | |
17 | // $Id: SecuritySupport.java 670282 2008-06-22 01:00:42Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.parsers; |
20 | 20 |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: EventFilter.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import javax.xml.stream.events.XMLEvent; | |
22 | ||
23 | public interface EventFilter { | |
24 | public boolean accept(XMLEvent event); | |
25 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: FactoryConfigurationError.java 670245 2008-06-21 18:03:15Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public class FactoryConfigurationError extends Error { | |
22 | ||
23 | private static final long serialVersionUID = -2994412584589975744L; | |
24 | ||
25 | private Exception nested; | |
26 | ||
27 | public FactoryConfigurationError() { | |
28 | super(); | |
29 | } | |
30 | ||
31 | public FactoryConfigurationError(Exception e) { | |
32 | nested = e; | |
33 | } | |
34 | ||
35 | public FactoryConfigurationError(Exception e, String msg) { | |
36 | super(msg); | |
37 | nested = e; | |
38 | } | |
39 | ||
40 | public FactoryConfigurationError(String msg) { | |
41 | super(msg); | |
42 | } | |
43 | ||
44 | public FactoryConfigurationError(String msg, Exception e) { | |
45 | super(msg); | |
46 | nested = e; | |
47 | } | |
48 | ||
49 | public Exception getException() { | |
50 | return nested; | |
51 | } | |
52 | ||
53 | public String getMessage() { | |
54 | String msg = super.getMessage(); | |
55 | if (msg != null) { | |
56 | return msg; | |
57 | } | |
58 | if (nested != null) { | |
59 | msg = nested.getMessage(); | |
60 | if (msg == null) | |
61 | msg = nested.getClass().toString(); | |
62 | } | |
63 | return msg; | |
64 | } | |
65 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: FactoryFinder.java 670281 2008-06-22 00:55:09Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import java.io.BufferedReader; | |
22 | import java.io.File; | |
23 | import java.io.IOException; | |
24 | import java.io.InputStream; | |
25 | import java.io.InputStreamReader; | |
26 | import java.util.Properties; | |
27 | ||
28 | /** | |
29 | * This class is duplicated for each JAXP subpackage so keep it in | |
30 | * sync. It is package private. | |
31 | * | |
32 | * This code is designed to implement the JAXP 1.1 spec pluggability | |
33 | * feature and is designed to run on JDK version 1.1 and later including | |
34 | * JVMs that perform early linking like the Microsoft JVM in IE 5. Note | |
35 | * however that it must be compiled on a JDK version 1.2 or later system | |
36 | * since it calls Thread#getContextClassLoader(). The code also runs both | |
37 | * as part of an unbundled jar file and when bundled as part of the JDK. | |
38 | */ | |
39 | final class FactoryFinder { | |
40 | ||
41 | /** | |
42 | * <p>Debug flag to trace loading process.</p> | |
43 | */ | |
44 | private static boolean debug = false; | |
45 | ||
46 | /** | |
47 | * <p>Cache properties for performance.</p> | |
48 | */ | |
49 | private static Properties cacheProps = new Properties(); | |
50 | ||
51 | /** | |
52 | * <p>First time requires initialization overhead.</p> | |
53 | */ | |
54 | private static boolean firstTime = true; | |
55 | ||
56 | /** | |
57 | * Default columns per line. | |
58 | */ | |
59 | private static final int DEFAULT_LINE_LENGTH = 80; | |
60 | ||
61 | // Define system property "jaxp.debug" to get output | |
62 | static { | |
63 | // Use try/catch block to support applets, which throws | |
64 | // SecurityException out of this code. | |
65 | try { | |
66 | String val = SecuritySupport.getSystemProperty("jaxp.debug"); | |
67 | // Allow simply setting the prop to turn on debug | |
68 | debug = val != null && (! "false".equals(val)); | |
69 | } catch (SecurityException se) { | |
70 | debug = false; | |
71 | } | |
72 | } | |
73 | ||
74 | private FactoryFinder() {} | |
75 | ||
76 | private static void dPrint(String msg) { | |
77 | if (debug) { | |
78 | System.err.println("JAXP: " + msg); | |
79 | } | |
80 | } | |
81 | ||
82 | /** | |
83 | * Create an instance of a class using the specified ClassLoader and | |
84 | * optionally fall back to the current ClassLoader if not found. | |
85 | * | |
86 | * @param className Name of the concrete class corresponding to the | |
87 | * service provider | |
88 | * | |
89 | * @param cl ClassLoader to use to load the class, null means to use | |
90 | * the bootstrap ClassLoader | |
91 | * | |
92 | * @param doFallback true if the current ClassLoader should be tried as | |
93 | * a fallback if the class is not found using cl | |
94 | */ | |
95 | private static Object newInstance(String className, ClassLoader cl, | |
96 | boolean doFallback) | |
97 | throws ConfigurationError | |
98 | { | |
99 | // assert(className != null); | |
100 | ||
101 | try { | |
102 | Class providerClass; | |
103 | if (cl == null) { | |
104 | // If classloader is null Use the bootstrap ClassLoader. | |
105 | // Thus Class.forName(String) will use the current | |
106 | // ClassLoader which will be the bootstrap ClassLoader. | |
107 | providerClass = Class.forName(className); | |
108 | } else { | |
109 | try { | |
110 | providerClass = cl.loadClass(className); | |
111 | } catch (ClassNotFoundException x) { | |
112 | if (doFallback) { | |
113 | // Fall back to current classloader | |
114 | cl = FactoryFinder.class.getClassLoader(); | |
115 | if (cl != null) { | |
116 | providerClass = cl.loadClass(className); | |
117 | } | |
118 | else { | |
119 | providerClass = Class.forName(className); | |
120 | } | |
121 | } else { | |
122 | throw x; | |
123 | } | |
124 | } | |
125 | } | |
126 | ||
127 | Object instance = providerClass.newInstance(); | |
128 | if (debug) dPrint("created new instance of " + providerClass + | |
129 | " using ClassLoader: " + cl); | |
130 | return instance; | |
131 | } catch (ClassNotFoundException x) { | |
132 | throw new ConfigurationError( | |
133 | "Provider " + className + " not found", x); | |
134 | } catch (Exception x) { | |
135 | throw new ConfigurationError( | |
136 | "Provider " + className + " could not be instantiated: " + x, | |
137 | x); | |
138 | } | |
139 | } | |
140 | ||
141 | /** | |
142 | * Finds the implementation Class object in the specified order. Main | |
143 | * entry point. | |
144 | * @return Class object of factory, never null | |
145 | * | |
146 | * @param factoryId Name of the factory to find, same as | |
147 | * a property name | |
148 | * @param fallbackClassName Implementation class name, if nothing else | |
149 | * is found. Use null to mean no fallback. | |
150 | * | |
151 | * Package private so this code can be shared. | |
152 | */ | |
153 | static Object find(String factoryId, String fallbackClassName) | |
154 | throws ConfigurationError { | |
155 | // Figure out which ClassLoader to use for loading the provider | |
156 | // class. If there is a Context ClassLoader then use it. | |
157 | ClassLoader classLoader = SecuritySupport.getContextClassLoader(); | |
158 | if (classLoader == null) { | |
159 | // if we have no Context ClassLoader | |
160 | // so use the current ClassLoader | |
161 | classLoader = FactoryFinder.class.getClassLoader(); | |
162 | } | |
163 | return find(factoryId, classLoader, fallbackClassName); | |
164 | } | |
165 | ||
166 | /** | |
167 | * Finds the implementation Class object in the specified order. Main | |
168 | * entry point. | |
169 | * @return Class object of factory, never null | |
170 | * | |
171 | * @param factoryId Name of the factory to find, same as | |
172 | * a property name | |
173 | * @param classLoader The ClassLoader to use | |
174 | * @param fallbackClassName Implementation class name, if nothing else | |
175 | * is found. Use null to mean no fallback. | |
176 | * | |
177 | * Package private so this code can be shared. | |
178 | */ | |
179 | static Object find(String factoryId, ClassLoader classLoader, String fallbackClassName) | |
180 | throws ConfigurationError { | |
181 | ||
182 | if (debug) dPrint("find factoryId =" + factoryId); | |
183 | ||
184 | // Use the system property first | |
185 | try { | |
186 | String systemProp = SecuritySupport.getSystemProperty(factoryId); | |
187 | if (systemProp != null && systemProp.length() > 0) { | |
188 | if (debug) dPrint("found system property, value=" + systemProp); | |
189 | return newInstance(systemProp, classLoader, true); | |
190 | } | |
191 | } catch (SecurityException se) { | |
192 | //if first option fails due to any reason we should try next option in the | |
193 | //look up algorithm. | |
194 | } | |
195 | ||
196 | // try to read from $java.home/lib/stax.properties | |
197 | try { | |
198 | String javah = SecuritySupport.getSystemProperty("java.home"); | |
199 | String configFile = javah + File.separator + | |
200 | "lib" + File.separator + "stax.properties"; | |
201 | String factoryClassName = null; | |
202 | if(firstTime){ | |
203 | synchronized(cacheProps){ | |
204 | if(firstTime){ | |
205 | File f=new File( configFile ); | |
206 | firstTime = false; | |
207 | if(SecuritySupport.doesFileExist(f)){ | |
208 | if (debug) dPrint("Read properties file "+f); | |
209 | //cacheProps.load( new FileInputStream(f)); | |
210 | cacheProps.load(SecuritySupport.getFileInputStream(f)); | |
211 | } | |
212 | } | |
213 | } | |
214 | } | |
215 | factoryClassName = cacheProps.getProperty(factoryId); | |
216 | ||
217 | if(factoryClassName != null){ | |
218 | if (debug) dPrint("found in $java.home/stax.properties, value=" + factoryClassName); | |
219 | return newInstance(factoryClassName, classLoader, true); | |
220 | } | |
221 | } catch(Exception ex ) { | |
222 | if( debug ) ex.printStackTrace(); | |
223 | } | |
224 | ||
225 | // Try Jar Service Provider Mechanism | |
226 | Object provider = findJarServiceProvider(factoryId); | |
227 | if (provider != null) { | |
228 | return provider; | |
229 | } | |
230 | if (fallbackClassName == null) { | |
231 | throw new ConfigurationError( | |
232 | "Provider for " + factoryId + " cannot be found", null); | |
233 | } | |
234 | ||
235 | if (debug) dPrint("loaded from fallback value: " + fallbackClassName); | |
236 | return newInstance(fallbackClassName, classLoader, true); | |
237 | } | |
238 | ||
239 | /* | |
240 | * Try to find provider using Jar Service Provider Mechanism | |
241 | * | |
242 | * @return instance of provider class if found or null | |
243 | */ | |
244 | private static Object findJarServiceProvider(String factoryId) | |
245 | throws ConfigurationError | |
246 | { | |
247 | ||
248 | String serviceId = "META-INF/services/" + factoryId; | |
249 | InputStream is = null; | |
250 | ||
251 | // First try the Context ClassLoader | |
252 | ClassLoader cl = SecuritySupport.getContextClassLoader(); | |
253 | if (cl != null) { | |
254 | is = SecuritySupport.getResourceAsStream(cl, serviceId); | |
255 | ||
256 | // If no provider found then try the current ClassLoader | |
257 | if (is == null) { | |
258 | cl = FactoryFinder.class.getClassLoader(); | |
259 | is = SecuritySupport.getResourceAsStream(cl, serviceId); | |
260 | } | |
261 | } else { | |
262 | // No Context ClassLoader, try the current | |
263 | // ClassLoader | |
264 | cl = FactoryFinder.class.getClassLoader(); | |
265 | is = SecuritySupport.getResourceAsStream(cl, serviceId); | |
266 | } | |
267 | ||
268 | if (is == null) { | |
269 | // No provider found | |
270 | return null; | |
271 | } | |
272 | ||
273 | if (debug) dPrint("found jar resource=" + serviceId + | |
274 | " using ClassLoader: " + cl); | |
275 | ||
276 | // Read the service provider name in UTF-8 as specified in | |
277 | // the jar spec. Unfortunately this fails in Microsoft | |
278 | // VJ++, which does not implement the UTF-8 | |
279 | // encoding. Theoretically, we should simply let it fail in | |
280 | // that case, since the JVM is obviously broken if it | |
281 | // doesn't support such a basic standard. But since there | |
282 | // are still some users attempting to use VJ++ for | |
283 | // development, we have dropped in a fallback which makes a | |
284 | // second attempt using the platform's default encoding. In | |
285 | // VJ++ this is apparently ASCII, which is a subset of | |
286 | // UTF-8... and since the strings we'll be reading here are | |
287 | // also primarily limited to the 7-bit ASCII range (at | |
288 | // least, in English versions), this should work well | |
289 | // enough to keep us on the air until we're ready to | |
290 | // officially decommit from VJ++. [Edited comment from | |
291 | // jkesselm] | |
292 | BufferedReader rd; | |
293 | try { | |
294 | rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); | |
295 | } catch (java.io.UnsupportedEncodingException e) { | |
296 | rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); | |
297 | } | |
298 | ||
299 | String factoryClassName = null; | |
300 | try { | |
301 | // XXX Does not handle all possible input as specified by the | |
302 | // Jar Service Provider specification | |
303 | factoryClassName = rd.readLine(); | |
304 | } | |
305 | catch (IOException x) { | |
306 | // No provider found | |
307 | return null; | |
308 | } | |
309 | finally { | |
310 | try { | |
311 | // try to close the reader. | |
312 | rd.close(); | |
313 | } | |
314 | // Ignore the exception. | |
315 | catch (IOException exc) {} | |
316 | } | |
317 | ||
318 | if (factoryClassName != null && | |
319 | ! "".equals(factoryClassName)) { | |
320 | if (debug) dPrint("found in resource, value=" | |
321 | + factoryClassName); | |
322 | ||
323 | // Note: here we do not want to fall back to the current | |
324 | // ClassLoader because we want to avoid the case where the | |
325 | // resource file was found using one ClassLoader and the | |
326 | // provider class was instantiated using a different one. | |
327 | return newInstance(factoryClassName, cl, false); | |
328 | } | |
329 | ||
330 | // No provider found | |
331 | return null; | |
332 | } | |
333 | ||
334 | static class ConfigurationError extends Error { | |
335 | private static final long serialVersionUID = 1L; | |
336 | private Exception exception; | |
337 | ||
338 | /** | |
339 | * Construct a new instance with the specified detail string and | |
340 | * exception. | |
341 | */ | |
342 | ConfigurationError(String msg, Exception x) { | |
343 | super(msg); | |
344 | this.exception = x; | |
345 | } | |
346 | ||
347 | Exception getException() { | |
348 | return exception; | |
349 | } | |
350 | } | |
351 | ||
352 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: Location.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public interface Location { | |
22 | public int getCharacterOffset(); | |
23 | ||
24 | public int getColumnNumber(); | |
25 | ||
26 | public int getLineNumber(); | |
27 | ||
28 | public String getPublicId(); | |
29 | ||
30 | public String getSystemId(); | |
31 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: SecuritySupport.java 670281 2008-06-22 00:55:09Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import java.io.File; | |
22 | import java.io.FileInputStream; | |
23 | import java.io.FileNotFoundException; | |
24 | import java.io.InputStream; | |
25 | import java.security.AccessController; | |
26 | import java.security.PrivilegedAction; | |
27 | import java.security.PrivilegedActionException; | |
28 | import java.security.PrivilegedExceptionAction; | |
29 | ||
30 | /** | |
31 | * This class is duplicated for each JAXP subpackage so keep it in sync. | |
32 | * It is package private and therefore is not exposed as part of the JAXP | |
33 | * API. | |
34 | * | |
35 | * Security related methods that only work on J2SE 1.2 and newer. | |
36 | */ | |
37 | final class SecuritySupport { | |
38 | ||
39 | private SecuritySupport() {} | |
40 | ||
41 | static ClassLoader getContextClassLoader() { | |
42 | return (ClassLoader) | |
43 | AccessController.doPrivileged(new PrivilegedAction() { | |
44 | public Object run() { | |
45 | ClassLoader cl = null; | |
46 | try { | |
47 | cl = Thread.currentThread().getContextClassLoader(); | |
48 | } catch (SecurityException ex) { } | |
49 | return cl; | |
50 | } | |
51 | }); | |
52 | } | |
53 | ||
54 | static String getSystemProperty(final String propName) { | |
55 | return (String) | |
56 | AccessController.doPrivileged(new PrivilegedAction() { | |
57 | public Object run() { | |
58 | return System.getProperty(propName); | |
59 | } | |
60 | }); | |
61 | } | |
62 | ||
63 | static FileInputStream getFileInputStream(final File file) | |
64 | throws FileNotFoundException | |
65 | { | |
66 | try { | |
67 | return (FileInputStream) | |
68 | AccessController.doPrivileged(new PrivilegedExceptionAction() { | |
69 | public Object run() throws FileNotFoundException { | |
70 | return new FileInputStream(file); | |
71 | } | |
72 | }); | |
73 | } catch (PrivilegedActionException e) { | |
74 | throw (FileNotFoundException)e.getException(); | |
75 | } | |
76 | } | |
77 | ||
78 | static InputStream getResourceAsStream(final ClassLoader cl, | |
79 | final String name) | |
80 | { | |
81 | return (InputStream) | |
82 | AccessController.doPrivileged(new PrivilegedAction() { | |
83 | public Object run() { | |
84 | InputStream ris; | |
85 | if (cl == null) { | |
86 | ris = ClassLoader.getSystemResourceAsStream(name); | |
87 | } else { | |
88 | ris = cl.getResourceAsStream(name); | |
89 | } | |
90 | return ris; | |
91 | } | |
92 | }); | |
93 | } | |
94 | ||
95 | static boolean doesFileExist(final File f) { | |
96 | return ((Boolean) | |
97 | AccessController.doPrivileged(new PrivilegedAction() { | |
98 | public Object run() { | |
99 | return f.exists() ? Boolean.TRUE : Boolean.FALSE; | |
100 | } | |
101 | })).booleanValue(); | |
102 | } | |
103 | ||
104 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: StreamFilter.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public interface StreamFilter { | |
22 | public boolean accept(XMLStreamReader reader); | |
23 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLEventFactory.java 730320 2008-12-31 06:20:06Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import java.util.Iterator; | |
22 | ||
23 | import javax.xml.namespace.NamespaceContext; | |
24 | import javax.xml.stream.events.ProcessingInstruction; | |
25 | import javax.xml.namespace.QName; | |
26 | import javax.xml.stream.events.Characters; | |
27 | import javax.xml.stream.events.Comment; | |
28 | import javax.xml.stream.events.DTD; | |
29 | import javax.xml.stream.events.EndElement; | |
30 | import javax.xml.stream.events.EntityDeclaration; | |
31 | import javax.xml.stream.events.Namespace; | |
32 | import javax.xml.stream.events.Attribute; | |
33 | import javax.xml.stream.events.EndDocument; | |
34 | import javax.xml.stream.events.EntityReference; | |
35 | import javax.xml.stream.events.StartDocument; | |
36 | import javax.xml.stream.events.StartElement; | |
37 | ||
38 | public abstract class XMLEventFactory { | |
39 | ||
40 | private static final String PROPERTY_NAME = "javax.xml.stream.XMLEventFactory"; | |
41 | private static final String DEFAULT_FACTORY = "org.apache.xerces.stax.XMLEventFactoryImpl"; | |
42 | ||
43 | protected XMLEventFactory() {} | |
44 | ||
45 | public static XMLEventFactory newInstance() | |
46 | throws FactoryConfigurationError { | |
47 | try { | |
48 | return (XMLEventFactory) FactoryFinder.find(PROPERTY_NAME, DEFAULT_FACTORY); | |
49 | } | |
50 | catch (FactoryFinder.ConfigurationError e) { | |
51 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
52 | } | |
53 | } | |
54 | ||
55 | public static XMLEventFactory newInstance(String factoryId, | |
56 | ClassLoader classLoader) throws FactoryConfigurationError { | |
57 | if (classLoader == null) { | |
58 | classLoader = SecuritySupport.getContextClassLoader(); | |
59 | } | |
60 | try { | |
61 | return (XMLEventFactory) FactoryFinder.find(factoryId, classLoader, DEFAULT_FACTORY); | |
62 | } | |
63 | catch (FactoryFinder.ConfigurationError e) { | |
64 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
65 | } | |
66 | } | |
67 | ||
68 | public abstract void setLocation(Location location); | |
69 | ||
70 | public abstract Attribute createAttribute(QName name, String value); | |
71 | ||
72 | public abstract Attribute createAttribute(String localName, String value); | |
73 | ||
74 | public abstract Attribute createAttribute(String prefix, | |
75 | String namespaceURI, String localName, String value); | |
76 | ||
77 | public abstract Namespace createNamespace(String namespaceUri); | |
78 | ||
79 | public abstract Namespace createNamespace(String prefix, String namespaceUri); | |
80 | ||
81 | public abstract StartElement createStartElement(QName name, | |
82 | Iterator attributes, Iterator namespaces); | |
83 | ||
84 | public abstract StartElement createStartElement(String prefix, | |
85 | String namespaceUri, String localName); | |
86 | ||
87 | public abstract StartElement createStartElement(String prefix, | |
88 | String namespaceUri, String localName, Iterator attributes, | |
89 | Iterator namespaces); | |
90 | ||
91 | public abstract StartElement createStartElement(String prefix, | |
92 | String namespaceUri, String localName, Iterator attributes, | |
93 | Iterator namespaces, NamespaceContext context); | |
94 | ||
95 | public abstract EndElement createEndElement(QName name, Iterator namespaces); | |
96 | ||
97 | public abstract EndElement createEndElement(String prefix, | |
98 | String namespaceUri, String localName); | |
99 | ||
100 | public abstract EndElement createEndElement(String prefix, | |
101 | String namespaceUri, String localName, Iterator namespaces); | |
102 | ||
103 | public abstract Characters createCharacters(String content); | |
104 | ||
105 | public abstract Characters createCData(String content); | |
106 | ||
107 | public abstract Characters createSpace(String content); | |
108 | ||
109 | public abstract Characters createIgnorableSpace(String content); | |
110 | ||
111 | public abstract StartDocument createStartDocument(); | |
112 | ||
113 | public abstract StartDocument createStartDocument(String encoding); | |
114 | ||
115 | public abstract StartDocument createStartDocument(String encoding, | |
116 | String version); | |
117 | ||
118 | public abstract StartDocument createStartDocument(String encoding, | |
119 | String version, boolean standalone); | |
120 | ||
121 | public abstract EndDocument createEndDocument(); | |
122 | ||
123 | public abstract EntityReference createEntityReference(String name, | |
124 | EntityDeclaration declaration); | |
125 | ||
126 | public abstract Comment createComment(String text); | |
127 | ||
128 | public abstract ProcessingInstruction createProcessingInstruction( | |
129 | String target, String data); | |
130 | ||
131 | public abstract DTD createDTD(String dtd); | |
132 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLEventReader.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import java.util.Iterator; | |
22 | ||
23 | import javax.xml.stream.events.XMLEvent; | |
24 | ||
25 | public interface XMLEventReader extends Iterator { | |
26 | public void close() throws XMLStreamException; | |
27 | ||
28 | public String getElementText() throws XMLStreamException; | |
29 | ||
30 | public Object getProperty(String name) throws IllegalArgumentException; | |
31 | ||
32 | public boolean hasNext(); | |
33 | ||
34 | public XMLEvent nextEvent() throws XMLStreamException; | |
35 | ||
36 | public XMLEvent nextTag() throws XMLStreamException; | |
37 | ||
38 | public XMLEvent peek() throws XMLStreamException; | |
39 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLEventWriter.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import javax.xml.namespace.NamespaceContext; | |
22 | import javax.xml.stream.events.XMLEvent; | |
23 | import javax.xml.stream.util.XMLEventConsumer; | |
24 | ||
25 | public interface XMLEventWriter extends XMLEventConsumer { | |
26 | public void add(XMLEvent event) throws XMLStreamException; | |
27 | ||
28 | public void add(XMLEventReader reader) throws XMLStreamException; | |
29 | ||
30 | public void close() throws XMLStreamException; | |
31 | ||
32 | public void flush() throws XMLStreamException; | |
33 | ||
34 | public NamespaceContext getNamespaceContext(); | |
35 | ||
36 | public String getPrefix(String uri) throws XMLStreamException; | |
37 | ||
38 | public void setDefaultNamespace(String uri) throws XMLStreamException; | |
39 | ||
40 | public void setNamespaceContext(NamespaceContext context) throws XMLStreamException; | |
41 | ||
42 | public void setPrefix(String prefix, String uri) throws XMLStreamException; | |
43 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLInputFactory.java 670283 2008-06-22 01:04:09Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import java.io.InputStream; | |
22 | import java.io.Reader; | |
23 | ||
24 | import javax.xml.stream.util.XMLEventAllocator; | |
25 | ||
26 | public abstract class XMLInputFactory { | |
27 | ||
28 | public static final String ALLOCATOR = "javax.xml.stream.allocator"; | |
29 | public static final String IS_COALESCING = "javax.xml.stream.isCoalescing"; | |
30 | public static final String IS_NAMESPACE_AWARE = "javax.xml.stream.isNamespaceAware"; | |
31 | public static final String IS_REPLACING_ENTITY_REFERENCES = "javax.xml.stream.isReplacingEntityReferences"; | |
32 | public static final String IS_SUPPORTING_EXTERNAL_ENTITIES = "javax.xml.stream.isSupportingExternalEntities"; | |
33 | public static final String IS_VALIDATING = "javax.xml.stream.isValidating"; | |
34 | public static final String REPORTER = "javax.xml.stream.reporter"; | |
35 | public static final String RESOLVER = "javax.xml.stream.resolver"; | |
36 | public static final String SUPPORT_DTD = "javax.xml.stream.supportDTD"; | |
37 | ||
38 | private static final String PROPERTY_NAME = "javax.xml.stream.XMLInputFactory"; | |
39 | private static final String DEFAULT_FACTORY = "com.ctc.wstx.stax.WstxInputFactory"; | |
40 | ||
41 | protected XMLInputFactory() {} | |
42 | ||
43 | public static XMLInputFactory newInstance() | |
44 | throws FactoryConfigurationError { | |
45 | try { | |
46 | return (XMLInputFactory) FactoryFinder.find(PROPERTY_NAME, DEFAULT_FACTORY); | |
47 | } | |
48 | catch (FactoryFinder.ConfigurationError e) { | |
49 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
50 | } | |
51 | } | |
52 | ||
53 | public static XMLInputFactory newInstance(String factoryId, | |
54 | ClassLoader classLoader) throws FactoryConfigurationError { | |
55 | if (classLoader == null) { | |
56 | classLoader = SecuritySupport.getContextClassLoader(); | |
57 | } | |
58 | try { | |
59 | return (XMLInputFactory) FactoryFinder.find(factoryId, classLoader, DEFAULT_FACTORY); | |
60 | } | |
61 | catch (FactoryFinder.ConfigurationError e) { | |
62 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
63 | } | |
64 | } | |
65 | ||
66 | public abstract XMLStreamReader createXMLStreamReader(Reader reader) | |
67 | throws XMLStreamException; | |
68 | ||
69 | public abstract XMLStreamReader createXMLStreamReader( | |
70 | javax.xml.transform.Source source) throws XMLStreamException; | |
71 | ||
72 | public abstract XMLStreamReader createXMLStreamReader( | |
73 | InputStream stream) throws XMLStreamException; | |
74 | ||
75 | public abstract XMLStreamReader createXMLStreamReader( | |
76 | InputStream stream, String encoding) | |
77 | throws XMLStreamException; | |
78 | ||
79 | public abstract XMLStreamReader createXMLStreamReader( | |
80 | String systemId, InputStream stream) | |
81 | throws XMLStreamException; | |
82 | ||
83 | public abstract XMLStreamReader createXMLStreamReader( | |
84 | String systemId, Reader reader) | |
85 | throws XMLStreamException; | |
86 | ||
87 | public abstract XMLEventReader createXMLEventReader(Reader reader) | |
88 | throws XMLStreamException; | |
89 | ||
90 | public abstract XMLEventReader createXMLEventReader( | |
91 | String systemId, Reader reader) | |
92 | throws XMLStreamException; | |
93 | ||
94 | public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader) | |
95 | throws XMLStreamException; | |
96 | ||
97 | public abstract XMLEventReader createXMLEventReader( | |
98 | javax.xml.transform.Source source) throws XMLStreamException; | |
99 | ||
100 | public abstract XMLEventReader createXMLEventReader( | |
101 | InputStream stream) throws XMLStreamException; | |
102 | ||
103 | public abstract XMLEventReader createXMLEventReader( | |
104 | InputStream stream, String encoding) | |
105 | throws XMLStreamException; | |
106 | ||
107 | public abstract XMLEventReader createXMLEventReader( | |
108 | String systemId, InputStream stream) | |
109 | throws XMLStreamException; | |
110 | ||
111 | public abstract XMLStreamReader createFilteredReader( | |
112 | XMLStreamReader reader, StreamFilter filter) | |
113 | throws XMLStreamException; | |
114 | ||
115 | public abstract XMLEventReader createFilteredReader(XMLEventReader reader, | |
116 | EventFilter filter) throws XMLStreamException; | |
117 | ||
118 | public abstract XMLResolver getXMLResolver(); | |
119 | ||
120 | public abstract void setXMLResolver(XMLResolver resolver); | |
121 | ||
122 | public abstract XMLReporter getXMLReporter(); | |
123 | ||
124 | public abstract void setXMLReporter(XMLReporter reporter); | |
125 | ||
126 | public abstract void setProperty(String name, | |
127 | Object value) throws IllegalArgumentException; | |
128 | ||
129 | public abstract Object getProperty(String name) | |
130 | throws IllegalArgumentException; | |
131 | ||
132 | public abstract boolean isPropertySupported(String name); | |
133 | ||
134 | public abstract void setEventAllocator(XMLEventAllocator allocator); | |
135 | ||
136 | public abstract XMLEventAllocator getEventAllocator(); | |
137 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLOutputFactory.java 670283 2008-06-22 01:04:09Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import java.io.OutputStream; | |
22 | import java.io.Writer; | |
23 | ||
24 | public abstract class XMLOutputFactory { | |
25 | ||
26 | public static final String IS_REPAIRING_NAMESPACES = "javax.xml.stream.isRepairingNamespaces"; | |
27 | ||
28 | private static final String PROPERTY_NAME = "javax.xml.stream.XMLOutputFactory"; | |
29 | private static final String DEFAULT_FACTORY = "com.ctc.wstx.stax.WstxOutputFactory"; | |
30 | ||
31 | protected XMLOutputFactory() {} | |
32 | ||
33 | public static XMLOutputFactory newInstance() | |
34 | throws FactoryConfigurationError { | |
35 | try { | |
36 | return (XMLOutputFactory) FactoryFinder.find(PROPERTY_NAME, DEFAULT_FACTORY); | |
37 | } | |
38 | catch (FactoryFinder.ConfigurationError e) { | |
39 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
40 | } | |
41 | } | |
42 | ||
43 | public static XMLInputFactory newInstance(String factoryId, | |
44 | ClassLoader classLoader) throws FactoryConfigurationError { | |
45 | if (classLoader == null) { | |
46 | classLoader = SecuritySupport.getContextClassLoader(); | |
47 | } | |
48 | try { | |
49 | return (XMLInputFactory) FactoryFinder.find(factoryId, | |
50 | classLoader, "com.ctc.wstx.stax.WstxInputFactory"); | |
51 | } | |
52 | catch (FactoryFinder.ConfigurationError e) { | |
53 | throw new FactoryConfigurationError(e.getException(), e.getMessage()); | |
54 | } | |
55 | } | |
56 | ||
57 | public abstract XMLStreamWriter createXMLStreamWriter(Writer stream) | |
58 | throws XMLStreamException; | |
59 | ||
60 | public abstract XMLStreamWriter createXMLStreamWriter( | |
61 | OutputStream stream) throws XMLStreamException; | |
62 | ||
63 | public abstract XMLStreamWriter createXMLStreamWriter( | |
64 | OutputStream stream, String encoding) | |
65 | throws XMLStreamException; | |
66 | ||
67 | public abstract XMLStreamWriter createXMLStreamWriter( | |
68 | javax.xml.transform.Result result) throws XMLStreamException; | |
69 | ||
70 | public abstract XMLEventWriter createXMLEventWriter( | |
71 | javax.xml.transform.Result result) throws XMLStreamException; | |
72 | ||
73 | public abstract XMLEventWriter createXMLEventWriter( | |
74 | OutputStream stream) throws XMLStreamException; | |
75 | ||
76 | public abstract XMLEventWriter createXMLEventWriter( | |
77 | OutputStream stream, String encoding) | |
78 | throws XMLStreamException; | |
79 | ||
80 | public abstract XMLEventWriter createXMLEventWriter(Writer stream) | |
81 | throws XMLStreamException; | |
82 | ||
83 | public abstract void setProperty(String name, Object value) | |
84 | throws IllegalArgumentException; | |
85 | ||
86 | public abstract Object getProperty(String name) | |
87 | throws IllegalArgumentException; | |
88 | ||
89 | public abstract boolean isPropertySupported(String name); | |
90 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLReporter.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public interface XMLReporter { | |
22 | void report(String message, | |
23 | String errorType, | |
24 | Object relatedInformation, | |
25 | Location location) throws XMLStreamException; | |
26 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLResolver.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public interface XMLResolver { | |
22 | public Object resolveEntity(String publicID, | |
23 | String systemID, | |
24 | String baseURI, | |
25 | String namespace) throws XMLStreamException; | |
26 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLStreamConstants.java 670269 2008-06-21 23:27:48Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public interface XMLStreamConstants { | |
22 | ||
23 | public static final int START_ELEMENT = 1; | |
24 | public static final int END_ELEMENT = 2; | |
25 | public static final int PROCESSING_INSTRUCTION = 3; | |
26 | public static final int CHARACTERS = 4; | |
27 | public static final int COMMENT = 5; | |
28 | public static final int SPACE = 6; | |
29 | public static final int START_DOCUMENT = 7; | |
30 | public static final int END_DOCUMENT = 8; | |
31 | public static final int ENTITY_REFERENCE = 9; | |
32 | public static final int ATTRIBUTE = 10; | |
33 | public static final int DTD = 11; | |
34 | public static final int CDATA = 12; | |
35 | public static final int NAMESPACE = 13; | |
36 | public static final int NOTATION_DECLARATION = 14; | |
37 | public static final int ENTITY_DECLARATION = 15; | |
38 | ||
39 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLStreamException.java 670245 2008-06-21 18:03:15Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | public class XMLStreamException extends Exception { | |
22 | ||
23 | private static final long serialVersionUID = 2018819321811497362L; | |
24 | ||
25 | protected Throwable nested; | |
26 | protected Location location; | |
27 | ||
28 | public XMLStreamException() { | |
29 | super(); | |
30 | } | |
31 | ||
32 | public XMLStreamException(String msg) { | |
33 | super(msg); | |
34 | } | |
35 | ||
36 | public XMLStreamException(Throwable th) { | |
37 | this.nested = th; | |
38 | } | |
39 | ||
40 | public XMLStreamException(String msg, Throwable th) { | |
41 | super(msg); | |
42 | this.nested = th; | |
43 | } | |
44 | ||
45 | public XMLStreamException(String msg, Location location, | |
46 | Throwable th) { | |
47 | super(msg); | |
48 | this.location = location; | |
49 | this.nested = th; | |
50 | } | |
51 | ||
52 | public XMLStreamException(String msg, Location location) { | |
53 | super(msg); | |
54 | this.location = location; | |
55 | } | |
56 | ||
57 | public Throwable getNestedException() { | |
58 | return nested; | |
59 | } | |
60 | ||
61 | public Location getLocation() { | |
62 | return location; | |
63 | } | |
64 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLStreamReader.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import javax.xml.namespace.NamespaceContext; | |
22 | import javax.xml.namespace.QName; | |
23 | ||
24 | public interface XMLStreamReader extends XMLStreamConstants { | |
25 | public void close() throws XMLStreamException; | |
26 | ||
27 | public int getAttributeCount(); | |
28 | ||
29 | public String getAttributeLocalName(int index); | |
30 | ||
31 | public QName getAttributeName(int index); | |
32 | ||
33 | public String getAttributeNamespace(int index); | |
34 | ||
35 | public String getAttributePrefix(int index); | |
36 | ||
37 | public String getAttributeType(int index); | |
38 | ||
39 | public String getAttributeValue(int index); | |
40 | ||
41 | public String getAttributeValue(String namespaceURI, | |
42 | String localName); | |
43 | ||
44 | public String getCharacterEncodingScheme(); | |
45 | ||
46 | public String getElementText() throws XMLStreamException; | |
47 | ||
48 | public String getEncoding(); | |
49 | ||
50 | public int getEventType(); | |
51 | ||
52 | public String getLocalName(); | |
53 | ||
54 | public Location getLocation(); | |
55 | ||
56 | public QName getName(); | |
57 | ||
58 | public NamespaceContext getNamespaceContext(); | |
59 | ||
60 | public int getNamespaceCount(); | |
61 | ||
62 | public String getNamespacePrefix(int index); | |
63 | ||
64 | public String getNamespaceURI(); | |
65 | ||
66 | public String getNamespaceURI(int index); | |
67 | ||
68 | public String getNamespaceURI(String prefix); | |
69 | ||
70 | public String getPIData(); | |
71 | ||
72 | public String getPITarget(); | |
73 | ||
74 | public String getPrefix(); | |
75 | ||
76 | public java.lang.Object getProperty(String name) throws IllegalArgumentException; | |
77 | ||
78 | public String getText(); | |
79 | ||
80 | public char[] getTextCharacters(); | |
81 | ||
82 | public int getTextCharacters(int sourceStart, char[] target, int targetStart, | |
83 | int length) throws XMLStreamException; | |
84 | ||
85 | public int getTextLength(); | |
86 | ||
87 | public int getTextStart(); | |
88 | ||
89 | public String getVersion(); | |
90 | ||
91 | public boolean hasName(); | |
92 | ||
93 | public boolean hasNext() throws XMLStreamException; | |
94 | ||
95 | public boolean hasText(); | |
96 | ||
97 | public boolean isAttributeSpecified(int index); | |
98 | ||
99 | public boolean isCharacters(); | |
100 | ||
101 | public boolean isEndElement(); | |
102 | ||
103 | public boolean isStandalone(); | |
104 | ||
105 | public boolean isStartElement(); | |
106 | ||
107 | public boolean isWhiteSpace(); | |
108 | ||
109 | public int next() throws XMLStreamException; | |
110 | ||
111 | public int nextTag() throws XMLStreamException ; | |
112 | ||
113 | public void require(int type, String namespaceURI, | |
114 | String localName) throws XMLStreamException ; | |
115 | ||
116 | public boolean standaloneSet(); | |
117 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLStreamWriter.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream; | |
20 | ||
21 | import javax.xml.namespace.NamespaceContext; | |
22 | ||
23 | public interface XMLStreamWriter { | |
24 | public void close() throws XMLStreamException; | |
25 | ||
26 | public void flush() throws XMLStreamException; | |
27 | ||
28 | public NamespaceContext getNamespaceContext(); | |
29 | ||
30 | public String getPrefix(String uri) throws XMLStreamException; | |
31 | ||
32 | public Object getProperty(String name) throws IllegalArgumentException; | |
33 | ||
34 | public void setDefaultNamespace(String uri) throws XMLStreamException; | |
35 | ||
36 | public void setNamespaceContext(NamespaceContext context) | |
37 | throws XMLStreamException; | |
38 | ||
39 | public void setPrefix(String prefix, String uri) throws XMLStreamException; | |
40 | ||
41 | public void writeAttribute(String localName, String value) | |
42 | throws XMLStreamException; | |
43 | ||
44 | public void writeAttribute(String namespaceURI, String localName, | |
45 | String value) throws XMLStreamException; | |
46 | ||
47 | public void writeAttribute(String prefix, String namespaceURI, | |
48 | String localName, String value) throws XMLStreamException; | |
49 | ||
50 | public void writeCData(String data) throws XMLStreamException; | |
51 | ||
52 | public void writeCharacters(char[] text, int start, int len) | |
53 | throws XMLStreamException; | |
54 | ||
55 | public void writeCharacters(String text) throws XMLStreamException; | |
56 | ||
57 | public void writeComment(String data) throws XMLStreamException; | |
58 | ||
59 | public void writeDefaultNamespace(String namespaceURI) | |
60 | throws XMLStreamException; | |
61 | ||
62 | public void writeDTD(String dtd) throws XMLStreamException; | |
63 | ||
64 | public void writeEmptyElement(String localName) throws XMLStreamException; | |
65 | ||
66 | public void writeEmptyElement(String namespaceURI, String localName) | |
67 | throws XMLStreamException; | |
68 | ||
69 | public void writeEmptyElement(String prefix, String localName, | |
70 | String namespaceURI) throws XMLStreamException; | |
71 | ||
72 | public void writeEndDocument() throws XMLStreamException; | |
73 | ||
74 | public void writeEndElement() throws XMLStreamException; | |
75 | ||
76 | public void writeEntityRef(String name) throws XMLStreamException; | |
77 | ||
78 | public void writeNamespace(String prefix, String namespaceURI) | |
79 | throws XMLStreamException; | |
80 | ||
81 | public void writeProcessingInstruction(String target) | |
82 | throws XMLStreamException; | |
83 | ||
84 | public void writeProcessingInstruction(String target, String data) | |
85 | throws XMLStreamException; | |
86 | ||
87 | public void writeStartDocument() throws XMLStreamException; | |
88 | ||
89 | public void writeStartDocument(String version) throws XMLStreamException; | |
90 | ||
91 | public void writeStartDocument(String encoding, String version) | |
92 | throws XMLStreamException; | |
93 | ||
94 | public void writeStartElement(String localName) throws XMLStreamException; | |
95 | ||
96 | public void writeStartElement(String namespaceURI, String localName) | |
97 | throws XMLStreamException; | |
98 | ||
99 | public void writeStartElement(String prefix, String localName, | |
100 | String namespaceURI) throws XMLStreamException; | |
101 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: Attribute.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | import javax.xml.namespace.QName; | |
22 | ||
23 | public interface Attribute extends XMLEvent { | |
24 | public String getDTDType(); | |
25 | ||
26 | public QName getName(); | |
27 | ||
28 | public String getValue(); | |
29 | ||
30 | public boolean isSpecified(); | |
31 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: Characters.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface Characters extends XMLEvent { | |
22 | public String getData(); | |
23 | ||
24 | public boolean isCData(); | |
25 | ||
26 | public boolean isIgnorableWhiteSpace(); | |
27 | ||
28 | public boolean isWhiteSpace(); | |
29 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: Comment.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface Comment extends XMLEvent { | |
22 | public String getText(); | |
23 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: DTD.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | import java.util.List; | |
22 | ||
23 | public interface DTD extends XMLEvent { | |
24 | public String getDocumentTypeDeclaration(); | |
25 | ||
26 | public List getEntities(); | |
27 | ||
28 | public List getNotations(); | |
29 | ||
30 | public Object getProcessedDTD(); | |
31 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: EndDocument.java 669791 2008-06-20 04:54:13Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface EndDocument extends XMLEvent { | |
22 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: EndElement.java 669791 2008-06-20 04:54:13Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | import java.util.Iterator; | |
22 | ||
23 | import javax.xml.namespace.QName; | |
24 | ||
25 | public interface EndElement extends XMLEvent { | |
26 | public QName getName(); | |
27 | public Iterator getNamespaces(); | |
28 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: EntityDeclaration.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface EntityDeclaration extends XMLEvent { | |
22 | public String getBaseURI(); | |
23 | ||
24 | public String getName(); | |
25 | ||
26 | public String getNotationName(); | |
27 | ||
28 | public String getPublicId(); | |
29 | ||
30 | public String getReplacementText(); | |
31 | ||
32 | public String getSystemId(); | |
33 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: EntityReference.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface EntityReference extends XMLEvent { | |
22 | public EntityDeclaration getDeclaration(); | |
23 | ||
24 | public String getName(); | |
25 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: Namespace.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface Namespace extends Attribute { | |
22 | public String getNamespaceURI(); | |
23 | ||
24 | public String getPrefix(); | |
25 | ||
26 | public boolean isDefaultNamespaceDeclaration(); | |
27 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: NotationDeclaration.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface NotationDeclaration extends XMLEvent { | |
22 | public String getName(); | |
23 | ||
24 | public String getPublicId(); | |
25 | ||
26 | public String getSystemId(); | |
27 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: ProcessingInstruction.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface ProcessingInstruction extends XMLEvent { | |
22 | public String getData(); | |
23 | ||
24 | public String getTarget(); | |
25 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: StartDocument.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | public interface StartDocument extends XMLEvent { | |
22 | public boolean encodingSet(); | |
23 | ||
24 | public String getCharacterEncodingScheme(); | |
25 | ||
26 | public String getSystemId(); | |
27 | ||
28 | public String getVersion(); | |
29 | ||
30 | public boolean isStandalone(); | |
31 | ||
32 | public boolean standaloneSet(); | |
33 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: StartElement.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | import java.util.Iterator; | |
22 | import javax.xml.namespace.NamespaceContext; | |
23 | import javax.xml.namespace.QName; | |
24 | ||
25 | public interface StartElement extends XMLEvent { | |
26 | public Attribute getAttributeByName(QName name); | |
27 | ||
28 | public Iterator getAttributes(); | |
29 | ||
30 | public QName getName(); | |
31 | ||
32 | public NamespaceContext getNamespaceContext(); | |
33 | ||
34 | public Iterator getNamespaces(); | |
35 | ||
36 | public String getNamespaceURI(String prefix); | |
37 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLEvent.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.events; | |
20 | ||
21 | import java.io.Writer; | |
22 | ||
23 | import javax.xml.namespace.QName; | |
24 | import javax.xml.stream.Location; | |
25 | import javax.xml.stream.XMLStreamConstants; | |
26 | import javax.xml.stream.XMLStreamException; | |
27 | ||
28 | public interface XMLEvent extends XMLStreamConstants { | |
29 | public Characters asCharacters(); | |
30 | ||
31 | public EndElement asEndElement(); | |
32 | ||
33 | public StartElement asStartElement(); | |
34 | ||
35 | public int getEventType(); | |
36 | ||
37 | public Location getLocation(); | |
38 | ||
39 | public QName getSchemaType(); | |
40 | ||
41 | public boolean isAttribute(); | |
42 | ||
43 | public boolean isCharacters(); | |
44 | ||
45 | public boolean isEndDocument(); | |
46 | ||
47 | public boolean isEndElement(); | |
48 | ||
49 | public boolean isEntityReference(); | |
50 | ||
51 | public boolean isNamespace(); | |
52 | ||
53 | public boolean isProcessingInstruction(); | |
54 | ||
55 | public boolean isStartDocument(); | |
56 | ||
57 | public boolean isStartElement(); | |
58 | ||
59 | public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException; | |
60 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: EventReaderDelegate.java 670273 2008-06-21 23:31:31Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.util; | |
20 | ||
21 | import javax.xml.stream.XMLEventReader; | |
22 | import javax.xml.stream.XMLStreamException; | |
23 | import javax.xml.stream.events.XMLEvent; | |
24 | ||
25 | public class EventReaderDelegate implements XMLEventReader { | |
26 | ||
27 | private XMLEventReader reader; | |
28 | ||
29 | public EventReaderDelegate() {} | |
30 | ||
31 | public EventReaderDelegate(XMLEventReader reader) { | |
32 | this.reader = reader; | |
33 | } | |
34 | ||
35 | public void setParent(XMLEventReader reader) { | |
36 | this.reader = reader; | |
37 | } | |
38 | ||
39 | public XMLEventReader getParent() { | |
40 | return reader; | |
41 | } | |
42 | ||
43 | /* | |
44 | * XMLEventReader methods | |
45 | */ | |
46 | ||
47 | public void close() throws XMLStreamException { | |
48 | reader.close(); | |
49 | } | |
50 | ||
51 | public String getElementText() throws XMLStreamException { | |
52 | return reader.getElementText(); | |
53 | } | |
54 | ||
55 | public Object getProperty(String name) | |
56 | throws IllegalArgumentException { | |
57 | return reader.getProperty(name); | |
58 | } | |
59 | ||
60 | public boolean hasNext() { | |
61 | return reader.hasNext(); | |
62 | } | |
63 | ||
64 | public Object next() { | |
65 | return reader.next(); | |
66 | } | |
67 | ||
68 | public XMLEvent nextEvent() throws XMLStreamException { | |
69 | return reader.nextEvent(); | |
70 | } | |
71 | ||
72 | public XMLEvent nextTag() throws XMLStreamException { | |
73 | return reader.nextTag(); | |
74 | } | |
75 | ||
76 | public XMLEvent peek() throws XMLStreamException { | |
77 | return reader.peek(); | |
78 | } | |
79 | ||
80 | public void remove() { | |
81 | reader.remove(); | |
82 | } | |
83 | }⏎ |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: StreamReaderDelegate.java 670273 2008-06-21 23:31:31Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.util; | |
20 | ||
21 | import javax.xml.namespace.NamespaceContext; | |
22 | import javax.xml.namespace.QName; | |
23 | import javax.xml.stream.Location; | |
24 | import javax.xml.stream.XMLStreamException; | |
25 | import javax.xml.stream.XMLStreamReader; | |
26 | ||
27 | public class StreamReaderDelegate implements XMLStreamReader { | |
28 | ||
29 | private XMLStreamReader reader; | |
30 | ||
31 | public StreamReaderDelegate() {} | |
32 | ||
33 | public StreamReaderDelegate(XMLStreamReader reader) { | |
34 | this.reader = reader; | |
35 | } | |
36 | ||
37 | public void setParent(XMLStreamReader reader) { | |
38 | this.reader = reader; | |
39 | } | |
40 | ||
41 | public XMLStreamReader getParent() { | |
42 | return reader; | |
43 | } | |
44 | ||
45 | /* | |
46 | * XMLStreamReader methods | |
47 | */ | |
48 | ||
49 | public int next() throws XMLStreamException { | |
50 | return reader.next(); | |
51 | } | |
52 | ||
53 | public int nextTag() throws XMLStreamException { | |
54 | return reader.nextTag(); | |
55 | } | |
56 | ||
57 | public String getElementText() throws XMLStreamException { | |
58 | return reader.getElementText(); | |
59 | } | |
60 | ||
61 | public void require(int type, String namespaceURI, String localName) | |
62 | throws XMLStreamException { | |
63 | reader.require(type, namespaceURI, localName); | |
64 | } | |
65 | ||
66 | public boolean hasNext() throws XMLStreamException { | |
67 | return reader.hasNext(); | |
68 | } | |
69 | ||
70 | public void close() throws XMLStreamException { | |
71 | reader.close(); | |
72 | } | |
73 | ||
74 | public String getNamespaceURI(String prefix) { | |
75 | return reader.getNamespaceURI(prefix); | |
76 | } | |
77 | ||
78 | public NamespaceContext getNamespaceContext() { | |
79 | return reader.getNamespaceContext(); | |
80 | } | |
81 | ||
82 | public boolean isStartElement() { | |
83 | return reader.isStartElement(); | |
84 | } | |
85 | ||
86 | public boolean isEndElement() { | |
87 | return reader.isEndElement(); | |
88 | } | |
89 | ||
90 | public boolean isCharacters() { | |
91 | return reader.isCharacters(); | |
92 | } | |
93 | ||
94 | public boolean isWhiteSpace() { | |
95 | return reader.isWhiteSpace(); | |
96 | } | |
97 | ||
98 | public String getAttributeValue(String namespaceURI, String localName) { | |
99 | return reader.getAttributeValue(namespaceURI, localName); | |
100 | } | |
101 | ||
102 | public int getAttributeCount() { | |
103 | return reader.getAttributeCount(); | |
104 | } | |
105 | ||
106 | public QName getAttributeName(int index) { | |
107 | return reader.getAttributeName(index); | |
108 | } | |
109 | ||
110 | public String getAttributePrefix(int index) { | |
111 | return reader.getAttributePrefix(index); | |
112 | } | |
113 | ||
114 | public String getAttributeNamespace(int index) { | |
115 | return reader.getAttributeNamespace(index); | |
116 | } | |
117 | ||
118 | public String getAttributeLocalName(int index) { | |
119 | return reader.getAttributeLocalName(index); | |
120 | } | |
121 | ||
122 | public String getAttributeType(int index) { | |
123 | return reader.getAttributeType(index); | |
124 | } | |
125 | ||
126 | public String getAttributeValue(int index) { | |
127 | return reader.getAttributeValue(index); | |
128 | } | |
129 | ||
130 | public boolean isAttributeSpecified(int index) { | |
131 | return reader.isAttributeSpecified(index); | |
132 | } | |
133 | ||
134 | public int getNamespaceCount() { | |
135 | return reader.getNamespaceCount(); | |
136 | } | |
137 | ||
138 | public String getNamespacePrefix(int index) { | |
139 | return reader.getNamespacePrefix(index); | |
140 | } | |
141 | ||
142 | public String getNamespaceURI(int index) { | |
143 | return reader.getNamespaceURI(index); | |
144 | } | |
145 | ||
146 | public int getEventType() { | |
147 | return reader.getEventType(); | |
148 | } | |
149 | ||
150 | public String getText() { | |
151 | return reader.getText(); | |
152 | } | |
153 | ||
154 | public int getTextCharacters(int sourceStart, char[] target, | |
155 | int targetStart, int length) throws XMLStreamException { | |
156 | return reader.getTextCharacters(sourceStart, target, targetStart, | |
157 | length); | |
158 | } | |
159 | ||
160 | public char[] getTextCharacters() { | |
161 | return reader.getTextCharacters(); | |
162 | } | |
163 | ||
164 | public int getTextStart() { | |
165 | return reader.getTextStart(); | |
166 | } | |
167 | ||
168 | public int getTextLength() { | |
169 | return reader.getTextLength(); | |
170 | } | |
171 | ||
172 | public String getEncoding() { | |
173 | return reader.getEncoding(); | |
174 | } | |
175 | ||
176 | public boolean hasText() { | |
177 | return reader.hasText(); | |
178 | } | |
179 | ||
180 | public Location getLocation() { | |
181 | return reader.getLocation(); | |
182 | } | |
183 | ||
184 | public QName getName() { | |
185 | return reader.getName(); | |
186 | } | |
187 | ||
188 | public String getLocalName() { | |
189 | return reader.getLocalName(); | |
190 | } | |
191 | ||
192 | public boolean hasName() { | |
193 | return reader.hasName(); | |
194 | } | |
195 | ||
196 | public String getNamespaceURI() { | |
197 | return reader.getNamespaceURI(); | |
198 | } | |
199 | ||
200 | public String getPrefix() { | |
201 | return reader.getPrefix(); | |
202 | } | |
203 | ||
204 | public String getVersion() { | |
205 | return reader.getVersion(); | |
206 | } | |
207 | ||
208 | public boolean isStandalone() { | |
209 | return reader.isStandalone(); | |
210 | } | |
211 | ||
212 | public boolean standaloneSet() { | |
213 | return reader.standaloneSet(); | |
214 | } | |
215 | ||
216 | public String getCharacterEncodingScheme() { | |
217 | return reader.getCharacterEncodingScheme(); | |
218 | } | |
219 | ||
220 | public String getPITarget() { | |
221 | return reader.getPITarget(); | |
222 | } | |
223 | ||
224 | public String getPIData() { | |
225 | return reader.getPIData(); | |
226 | } | |
227 | ||
228 | public Object getProperty(String name) throws IllegalArgumentException { | |
229 | return reader.getProperty(name); | |
230 | } | |
231 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLEventAllocator.java 669794 2008-06-20 05:13:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.util; | |
20 | ||
21 | import javax.xml.stream.XMLStreamException; | |
22 | import javax.xml.stream.XMLStreamReader; | |
23 | import javax.xml.stream.events.XMLEvent; | |
24 | ||
25 | public interface XMLEventAllocator { | |
26 | public XMLEvent allocate(XMLStreamReader reader) throws XMLStreamException; | |
27 | ||
28 | public void allocate(XMLStreamReader reader, XMLEventConsumer consumer) | |
29 | throws XMLStreamException; | |
30 | ||
31 | public XMLEventAllocator newInstance(); | |
32 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: XMLEventConsumer.java 669791 2008-06-20 04:54:13Z mrglavas $ | |
18 | ||
19 | package javax.xml.stream.util; | |
20 | ||
21 | import javax.xml.stream.XMLStreamException; | |
22 | import javax.xml.stream.events.XMLEvent; | |
23 | ||
24 | public interface XMLEventConsumer { | |
25 | public void add(XMLEvent event) throws XMLStreamException; | |
26 | } |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: FactoryFinder.java 670293 2008-06-22 01:34:02Z mrglavas $ | |
17 | // $Id: FactoryFinder.java 670431 2008-06-23 01:40:03Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.transform; |
20 | 20 | |
92 | 92 | * @param doFallback true if the current ClassLoader should be tried as |
93 | 93 | * a fallback if the class is not found using cl |
94 | 94 | */ |
95 | private static Object newInstance(String className, ClassLoader cl, | |
95 | static Object newInstance(String className, ClassLoader cl, | |
96 | 96 | boolean doFallback) |
97 | 97 | throws ConfigurationError |
98 | 98 | { |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: SecuritySupport.java 670291 2008-06-22 01:30:16Z mrglavas $ | |
17 | // $Id: SecuritySupport.java 670282 2008-06-22 01:00:42Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.transform; |
20 | 20 |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: TransformerFactory.java 570103 2007-08-27 13:24:55Z mrglavas $ | |
17 | // $Id: TransformerFactory.java 884963 2009-11-27 19:11:59Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.transform; |
20 | 20 | |
115 | 115 | "javax.xml.transform.TransformerFactory", |
116 | 116 | /* The fallback implementation class name */ |
117 | 117 | "org.apache.xalan.processor.TransformerFactoryImpl"); |
118 | } catch (FactoryFinder.ConfigurationError e) { | |
119 | throw new TransformerFactoryConfigurationError( | |
120 | e.getException(), | |
121 | e.getMessage()); | |
118 | } | |
119 | catch (FactoryFinder.ConfigurationError e) { | |
120 | throw new TransformerFactoryConfigurationError(e.getException(), e.getMessage()); | |
121 | } | |
122 | } | |
123 | ||
124 | /** | |
125 | * @return new TransformerFactory instance, never null. | |
126 | * | |
127 | * @throws TransformerFactoryConfigurationError Thrown if the implementation | |
128 | * is not available or cannot be instantiated. | |
129 | */ | |
130 | public static TransformerFactory newInstance(String factoryClassName, | |
131 | ClassLoader classLoader) throws TransformerFactoryConfigurationError { | |
132 | if (factoryClassName == null) { | |
133 | throw new TransformerFactoryConfigurationError("factoryClassName cannot be null."); | |
134 | } | |
135 | if (classLoader == null) { | |
136 | classLoader = SecuritySupport.getContextClassLoader(); | |
137 | } | |
138 | try { | |
139 | return (TransformerFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); | |
140 | } | |
141 | catch (FactoryFinder.ConfigurationError e) { | |
142 | throw new TransformerFactoryConfigurationError(e.getException(), e.getMessage()); | |
122 | 143 | } |
123 | 144 | } |
124 | 145 | |
135 | 156 | * @param source <code>Source </code> of XSLT document used to create |
136 | 157 | * <code>Transformer</code>. |
137 | 158 | * Examples of XML <code>Source</code>s include |
138 | * {@link javax.xml.transform.dom.DOMSource DOMSource}, | |
139 | * {@link javax.xml.transform.sax.SAXSource SAXSource}, and | |
140 | * {@link javax.xml.transform.stream.StreamSource StreamSource}. | |
159 | * {@link javax.xml.transform.stream.StreamSource StreamSource}, | |
160 | * {@link javax.xml.transform.sax.SAXSource SAXSource}, | |
161 | * {@link javax.xml.transform.dom.DOMSource DOMSource} and | |
162 | * {@link javax.xml.transform.stax.StAXSource StAXSource}. | |
141 | 163 | * |
142 | 164 | * @return A <code>Transformer</code> object that may be used to perform |
143 | 165 | * a transformation in a single <code>Thread</code>, never |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: StAXResult.java 670395 2008-06-22 18:50:54Z mrglavas $ | |
18 | ||
19 | package javax.xml.transform.stax; | |
20 | ||
21 | import javax.xml.stream.XMLEventWriter; | |
22 | import javax.xml.stream.XMLStreamWriter; | |
23 | import javax.xml.transform.Result; | |
24 | ||
25 | public class StAXResult implements Result { | |
26 | ||
27 | public static final String FEATURE = "http://javax.xml.transform.stax.StAXResult/feature"; | |
28 | ||
29 | private final XMLStreamWriter xmlStreamWriter; | |
30 | private final XMLEventWriter xmlEventWriter; | |
31 | ||
32 | public StAXResult(XMLStreamWriter xmlStreamWriter) { | |
33 | if (xmlStreamWriter == null) { | |
34 | throw new IllegalArgumentException("XMLStreamWriter cannot be null."); | |
35 | } | |
36 | this.xmlStreamWriter = xmlStreamWriter; | |
37 | this.xmlEventWriter = null; | |
38 | } | |
39 | ||
40 | public StAXResult(XMLEventWriter xmlEventWriter) { | |
41 | if (xmlEventWriter == null) { | |
42 | throw new IllegalArgumentException("XMLEventWriter cannot be null."); | |
43 | } | |
44 | this.xmlStreamWriter = null; | |
45 | this.xmlEventWriter = xmlEventWriter; | |
46 | } | |
47 | ||
48 | public XMLStreamWriter getXMLStreamWriter() { | |
49 | return xmlStreamWriter; | |
50 | } | |
51 | ||
52 | public XMLEventWriter getXMLEventWriter() { | |
53 | return xmlEventWriter; | |
54 | } | |
55 | ||
56 | public String getSystemId() { | |
57 | return null; | |
58 | } | |
59 | ||
60 | public void setSystemId(String systemId) { | |
61 | throw new UnsupportedOperationException("Setting systemId is not supported."); | |
62 | } | |
63 | } |
0 | /* | |
1 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
2 | * contributor license agreements. See the NOTICE file distributed with | |
3 | * this work for additional information regarding copyright ownership. | |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | * (the "License"); you may not use this file except in compliance with | |
6 | * the License. You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | // $Id: StAXSource.java 670394 2008-06-22 18:50:36Z mrglavas $ | |
18 | ||
19 | package javax.xml.transform.stax; | |
20 | ||
21 | import javax.xml.stream.XMLEventReader; | |
22 | import javax.xml.stream.XMLStreamConstants; | |
23 | import javax.xml.stream.XMLStreamException; | |
24 | import javax.xml.stream.XMLStreamReader; | |
25 | import javax.xml.stream.events.XMLEvent; | |
26 | import javax.xml.transform.Source; | |
27 | ||
28 | public class StAXSource implements Source { | |
29 | ||
30 | public static final String FEATURE = "http://javax.xml.transform.stax.StAXSource/feature"; | |
31 | ||
32 | private final XMLStreamReader xmlStreamReader; | |
33 | private final XMLEventReader xmlEventReader; | |
34 | private final String systemId; | |
35 | ||
36 | public StAXSource(XMLStreamReader xmlStreamReader) { | |
37 | if (xmlStreamReader == null) { | |
38 | throw new IllegalArgumentException("XMLStreamReader cannot be null."); | |
39 | } | |
40 | final int event = xmlStreamReader.getEventType(); | |
41 | if (event != XMLStreamConstants.START_DOCUMENT && | |
42 | event != XMLStreamConstants.START_ELEMENT) { | |
43 | throw new IllegalStateException("The state of the XMLStreamReader must be START_DOCUMENT or START_ELEMENT"); | |
44 | } | |
45 | this.xmlStreamReader = xmlStreamReader; | |
46 | this.xmlEventReader = null; | |
47 | this.systemId = xmlStreamReader.getLocation().getSystemId(); | |
48 | } | |
49 | ||
50 | public StAXSource(XMLEventReader xmlEventReader) | |
51 | throws XMLStreamException { | |
52 | if (xmlEventReader == null) { | |
53 | throw new IllegalArgumentException("XMLEventReader cannot be null."); | |
54 | } | |
55 | final XMLEvent event = xmlEventReader.peek(); | |
56 | if (!event.isStartDocument() && | |
57 | !event.isStartElement()) { | |
58 | throw new IllegalStateException("The state of the XMLEventReader must be START_DOCUMENT or START_ELEMENT"); | |
59 | } | |
60 | this.xmlStreamReader = null; | |
61 | this.xmlEventReader = xmlEventReader; | |
62 | this.systemId = event.getLocation().getSystemId(); | |
63 | } | |
64 | ||
65 | public XMLStreamReader getXMLStreamReader() { | |
66 | return xmlStreamReader; | |
67 | } | |
68 | ||
69 | public XMLEventReader getXMLEventReader() { | |
70 | return xmlEventReader; | |
71 | } | |
72 | ||
73 | public String getSystemId() { | |
74 | return systemId; | |
75 | } | |
76 | ||
77 | public void setSystemId(String systemId) { | |
78 | throw new UnsupportedOperationException("Setting systemId is not supported."); | |
79 | } | |
80 | } |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: StreamResult.java 829968 2009-10-26 21:15:03Z mrglavas $ | |
17 | // $Id: StreamResult.java 829970 2009-10-26 21:15:29Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.transform.stream; |
20 | 20 |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: StreamSource.java 829969 2009-10-26 21:15:12Z mrglavas $ | |
17 | // $Id: StreamSource.java 829971 2009-10-26 21:15:39Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.transform.stream; |
20 | 20 | |
32 | 32 | * <code>StreamSource</code> instances may only be used once.</p> |
33 | 33 | * |
34 | 34 | * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a> |
35 | * @version $Revision: 829969 $, $Date: 2009-10-26 17:15:12 -0400 (Mon, 26 Oct 2009) $ | |
35 | * @version $Revision: 829971 $, $Date: 2009-10-26 17:15:39 -0400 (Mon, 26 Oct 2009) $ | |
36 | 36 | */ |
37 | 37 | public class StreamSource implements Source { |
38 | 38 |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | |
17 | // $Id: SchemaFactory.java 569992 2007-08-27 04:18:22Z mrglavas $ | |
17 | // $Id: SchemaFactory.java 884952 2009-11-27 18:55:08Z mrglavas $ | |
18 | 18 | |
19 | 19 | package javax.xml.validation; |
20 | 20 | |
97 | 97 | * </table> |
98 | 98 | * |
99 | 99 | * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
100 | * @version $Revision: 569992 $, $Date: 2007-08-27 00:18:22 -0400 (Mon, 27 Aug 2007) $ | |
100 | * @version $Revision: 884952 $, $Date: 2009-11-27 13:55:08 -0500 (Fri, 27 Nov 2009) $ | |
101 | 101 | * @since 1.5 |
102 | 102 | */ |
103 | 103 | public abstract class SchemaFactory { |
195 | 195 | return f; |
196 | 196 | } |
197 | 197 | |
198 | /** | |
199 | * @return New instance of a <code>SchemaFactory</code> | |
200 | * | |
201 | * @throws IllegalArgumentException | |
202 | * If no implementation of the schema language is available. | |
203 | * | |
204 | * @throws NullPointerException | |
205 | * If the <tt>schemLanguage</tt> parameter is null. | |
206 | */ | |
207 | public static SchemaFactory newInstance(String schemaLanguage, | |
208 | String factoryClassName, ClassLoader classLoader) { | |
209 | if (schemaLanguage == null) { | |
210 | throw new NullPointerException(); | |
211 | } | |
212 | if (factoryClassName == null) { | |
213 | throw new IllegalArgumentException("factoryClassName cannot be null."); | |
214 | } | |
215 | if (classLoader == null) { | |
216 | classLoader = SecuritySupport.getContextClassLoader(); | |
217 | } | |
218 | SchemaFactory f = new SchemaFactoryFinder(classLoader).createInstance(factoryClassName); | |
219 | if (f == null || !f.isSchemaLanguageSupported(schemaLanguage)) { | |
220 | throw new IllegalArgumentException(schemaLanguage); | |
221 | } | |
222 | return f; | |
223 | } | |
224 | ||
198 | 225 | /** |
199 | 226 | * <p>Is specified schema supported by this <code>SchemaFactory</code>?</p> |
200 | 227 | * |
572 | 599 | * |
573 | 600 | * @param schemas |
574 | 601 | * inputs to be parsed. {@link SchemaFactory} is required |
575 | * to recognize {@link javax.xml.transform.sax.SAXSource}, | |
576 | * {@link StreamSource}, and {@link javax.xml.transform.dom.DOMSource}. | |
602 | * to recognize {@link StreamSource}, | |
603 | * {@link javax.xml.transform.sax.SAXSource}, | |
604 | * {@link javax.xml.transform.dom.DOMSource} | |
605 | * and {@link javax.xml.transform.stax.StAXSource}. | |
577 | 606 | * |
578 | 607 | * @return |
579 | 608 | * Always return a non-null valid {@link Schema} object. |
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | // $Id: SchemaFactoryFinder.java 727365 2008-12-17 12:59:01Z mrglavas $ | |
16 | // $Id: SchemaFactoryFinder.java 727367 2008-12-17 13:05:26Z mrglavas $ | |
17 | 17 | |
18 | 18 | package javax.xml.validation; |
19 | 19 | |
35 | 35 | * Implementation of {@link SchemaFactory#newInstance(String)}. |
36 | 36 | * |
37 | 37 | * @author <a href="Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
38 | * @version $Revision: 727365 $, $Date: 2008-12-17 07:59:01 -0500 (Wed, 17 Dec 2008) $ | |
38 | * @version $Revision: 727367 $, $Date: 2008-12-17 08:05:26 -0500 (Wed, 17 Dec 2008) $ | |
39 | 39 | * @since 1.5 |
40 | 40 | */ |
41 | 41 | final class SchemaFactoryFinder { |
42 | ||
43 | /** XML Schema language identifiers. */ | |
44 | private static final String W3C_XML_SCHEMA10_NS_URI = "http://www.w3.org/XML/XMLSchema/v1.0"; | |
45 | private static final String W3C_XML_SCHEMA11_NS_URI = "http://www.w3.org/XML/XMLSchema/v1.1"; | |
42 | 46 | |
43 | 47 | /** debug support code. */ |
44 | 48 | private static boolean debug = false; |
268 | 272 | } |
269 | 273 | } |
270 | 274 | |
271 | // platform default | |
272 | if (schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) { | |
273 | if (debug) debugPrintln("attempting to use the platform default XML Schema validator"); | |
275 | // platform defaults | |
276 | if (schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI) || schemaLanguage.equals(W3C_XML_SCHEMA10_NS_URI)) { | |
277 | if (debug) debugPrintln("attempting to use the platform default XML Schema 1.0 validator"); | |
274 | 278 | return createInstance("org.apache.xerces.jaxp.validation.XMLSchemaFactory"); |
279 | } | |
280 | else if (schemaLanguage.equals(W3C_XML_SCHEMA11_NS_URI)) { | |
281 | if (debug) debugPrintln("attempting to use the platform default XML Schema 1.1 validator"); | |
282 | return createInstance("org.apache.xerces.jaxp.validation.XMLSchema11Factory"); | |
275 | 283 | } |
276 | 284 | |
277 | 285 | if (debug) debugPrintln("all things were tried, but none was found. bailing out."); |
287 | 295 | * @return null |
288 | 296 | * if it fails. Error messages will be printed by this method. |
289 | 297 | */ |
290 | private SchemaFactory createInstance( String className ) { | |
298 | SchemaFactory createInstance( String className ) { | |
291 | 299 | try { |
292 | 300 | if (debug) debugPrintln("instanciating "+className); |
293 | 301 | Class clazz; |
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | // $Id: TypeInfoProvider.java 569992 2007-08-27 04:18:22Z mrglavas $ | |
16 | // $Id: TypeInfoProvider.java 884939 2009-11-27 18:20:46Z mrglavas $ | |
17 | 17 | |
18 | 18 | package javax.xml.validation; |
19 | 19 | |
34 | 34 | * {@link ValidatorHandler#getTypeInfoProvider()} method. |
35 | 35 | * |
36 | 36 | * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
37 | * @version $Revision: 569992 $, $Date: 2007-08-27 00:18:22 -0400 (Mon, 27 Aug 2007) $ | |
37 | * @version $Revision: 884939 $, $Date: 2009-11-27 13:20:46 -0500 (Fri, 27 Nov 2009) $ | |
38 | 38 | * @see org.w3c.dom.TypeInfo |
39 | 39 | * @since 1.5 |
40 | 40 | */ |
53 | 53 | * <p>Returns the immutable {@link TypeInfo} object for the current element.</p> |
54 | 54 | * |
55 | 55 | * <p> |
56 | * The method may only be called by the startElement event of | |
56 | * The method may only be called by the startElement and endElement event of | |
57 | 57 | * the {@link org.xml.sax.ContentHandler} that the application sets to the |
58 | 58 | * {@link ValidatorHandler}.</p> |
59 | 59 | * |
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | // $Id: Validator.java 446598 2006-09-15 12:55:40Z jeremias $ | |
16 | // $Id: Validator.java 888884 2009-12-09 17:36:46Z mrglavas $ | |
17 | 17 | |
18 | 18 | package javax.xml.validation; |
19 | 19 | |
42 | 42 | * |
43 | 43 | * Note that while the {@link #validate(javax.xml.transform.Source)} and {@link #validate(javax.xml.transform.Source, javax.xml.transform.Result)} |
44 | 44 | * methods take a {@link Source} instance, the <code>Source</code> |
45 | * instance must be a <code>SAXSource</code> or <code>DOMSource</code>. | |
45 | * instance must be a <code>SAXSource</code>, <code>DOMSource</code>, <code>StAXSource</code> or <code>StreamSource</code>. | |
46 | 46 | * |
47 | 47 | * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
48 | * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ | |
48 | * @version $Revision: 888884 $, $Date: 2009-12-09 12:36:46 -0500 (Wed, 09 Dec 2009) $ | |
49 | 49 | * @since 1.5 |
50 | 50 | */ |
51 | 51 | public abstract class Validator { |
108 | 108 | * <td></td> |
109 | 109 | * <td>{@link javax.xml.transform.sax.SAXSource}</td> |
110 | 110 | * <td>{@link javax.xml.transform.dom.DOMSource}</td> |
111 | * <td>{@link javax.xml.transform.stax.StAXSource}</td> | |
112 | * <td>{@link javax.xml.transform.stream.StreamSource}</td> | |
111 | 113 | * </tr> |
112 | 114 | * </thead> |
113 | 115 | * <tbody> |
115 | 117 | * <td><tt>null</tt></td> |
116 | 118 | * <td>OK</td> |
117 | 119 | * <td>OK</td> |
120 | * <td>OK</td> | |
121 | * <td>OK</td> | |
118 | 122 | * </tr> |
119 | 123 | * <tr> |
120 | 124 | * <td>{@link javax.xml.transform.sax.SAXResult}</td> |
121 | 125 | * <td>OK</td> |
122 | 126 | * <td>Err</td> |
127 | * <td>Err</td> | |
128 | * <td>Err</td> | |
123 | 129 | * </tr> |
124 | 130 | * <tr> |
125 | 131 | * <td>{@link javax.xml.transform.dom.DOMResult}</td> |
132 | * <td>Err</td> | |
133 | * <td>OK</td> | |
134 | * <td>Err</td> | |
135 | * <td>Err</td> | |
136 | * </tr> | |
137 | * <tr> | |
138 | * <td>{@link javax.xml.transform.stax.StAXResult}</td> | |
139 | * <td>Err</td> | |
140 | * <td>Err</td> | |
141 | * <td>OK</td> | |
142 | * <td>Err</td> | |
143 | * </tr> | |
144 | * <tr> | |
145 | * <td>{@link javax.xml.transform.stream.StreamResult}</td> | |
146 | * <td>Err</td> | |
147 | * <td>Err</td> | |
126 | 148 | * <td>Err</td> |
127 | 149 | * <td>OK</td> |
128 | 150 | * </tr> |
130 | 152 | * </table> |
131 | 153 | * |
132 | 154 | * <p> |
133 | * <strong>Note that {@link javax.xml.transform.stream.StreamSource} instances are not allowed.</strong> To process | |
134 | * a <code>StreamSource</code>, or to validate one {@link Source} into another kind of {@link Result}, use the identity transformer | |
155 | * To validate one {@link Source} into another kind of {@link Result}, use the identity transformer | |
135 | 156 | * (see {@link javax.xml.transform.TransformerFactory#newTransformer()}). |
136 | 157 | * |
137 | 158 | * <p> |
161 | 182 | * |
162 | 183 | * @throws IllegalArgumentException |
163 | 184 | * If the {@link Result} type doesn't match the {@link Source} type, |
164 | * or if the specified source is neither | |
165 | * {@link javax.xml.transform.sax.SAXSource} nor | |
166 | * {@link javax.xml.transform.dom.DOMSource}. | |
185 | * or if the specified source is not a | |
186 | * {@link javax.xml.transform.sax.SAXSource}, | |
187 | * {@link javax.xml.transform.dom.DOMSource}, | |
188 | * {@link javax.xml.transform.stax.StAXSource} or | |
189 | * {@link javax.xml.transform.stream.StreamSource}. | |
167 | 190 | * |
168 | 191 | * @throws SAXException |
169 | 192 | * If the {@link ErrorHandler} throws a {@link SAXException} or |
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | // $Id: XPathFactory.java 884953 2009-11-27 18:55:59Z mrglavas $ | |
16 | // $Id: XPathFactory.java 888889 2009-12-09 17:43:18Z mrglavas $ | |
17 | 17 | |
18 | 18 | package javax.xml.xpath; |
19 | 19 | |
25 | 25 | * |
26 | 26 | * @author <a href="mailto:Norman.Walsh@Sun.com">Norman Walsh</a> |
27 | 27 | * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> |
28 | * @version $Revision: 884953 $, $Date: 2009-11-27 13:55:59 -0500 (Fri, 27 Nov 2009) $ | |
28 | * @version $Revision: 888889 $, $Date: 2009-12-09 12:43:18 -0500 (Wed, 09 Dec 2009) $ | |
29 | 29 | * @since 1.5 |
30 | 30 | */ |
31 | 31 | public abstract class XPathFactory { |
42 | 42 | public static final String DEFAULT_OBJECT_MODEL_URI = "http://java.sun.com/jaxp/xpath/dom"; |
43 | 43 | |
44 | 44 | /** |
45 | * <p>Protected constructor as {@link #newInstance()} or {@link #newInstance(String uri)} | |
45 | * <p>Protected constructor as {@link #newInstance()}, {@link #newInstance(String uri)} | |
46 | * or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)} | |
46 | 47 | * should be used to create a new instance of an <code>XPathFactory</code>.</p> |
47 | 48 | */ |
48 | 49 | protected XPathFactory() { |
63 | 64 | * @return Instance of an <code>XPathFactory</code>. |
64 | 65 | */ |
65 | 66 | public static final XPathFactory newInstance() { |
66 | ||
67 | 67 | try { |
68 | 68 | return newInstance(DEFAULT_OBJECT_MODEL_URI); |
69 | } catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) { | |
69 | } | |
70 | catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) { | |
70 | 71 | throw new RuntimeException( |
71 | 72 | "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: " |
72 | 73 | + DEFAULT_OBJECT_MODEL_URI |
130 | 131 | */ |
131 | 132 | public static final XPathFactory newInstance(final String uri) |
132 | 133 | throws XPathFactoryConfigurationException { |
133 | ||
134 | 134 | if (uri == null) { |
135 | throw new NullPointerException( | |
136 | "XPathFactory#newInstance(String uri) cannot be called with uri == null" | |
137 | ); | |
138 | } | |
139 | ||
140 | if (uri.length() == 0) { | |
141 | throw new IllegalArgumentException( | |
142 | "XPathFactory#newInstance(String uri) cannot be called with uri == \"\"" | |
143 | ); | |
144 | } | |
145 | ||
146 | ClassLoader classLoader = SecuritySupport.getContextClassLoader(); | |
147 | ||
135 | throw new NullPointerException( | |
136 | "XPathFactory#newInstance(String uri) cannot be called with uri == null" | |
137 | ); | |
138 | } | |
139 | if (uri.length() == 0) { | |
140 | throw new IllegalArgumentException( | |
141 | "XPathFactory#newInstance(String uri) cannot be called with uri == \"\"" | |
142 | ); | |
143 | } | |
144 | ClassLoader classLoader = SecuritySupport.getContextClassLoader(); | |
148 | 145 | if (classLoader == null) { |
149 | 146 | //use the current class loader |
150 | 147 | classLoader = XPathFactory.class.getClassLoader(); |
151 | 148 | } |
152 | ||
153 | XPathFactory xpathFactory = new XPathFactoryFinder(classLoader).newFactory(uri); | |
154 | ||
155 | if (xpathFactory == null) { | |
156 | throw new XPathFactoryConfigurationException( | |
157 | "No XPathFctory implementation found for the object model: " | |
158 | + uri | |
159 | ); | |
160 | } | |
161 | ||
162 | return xpathFactory; | |
149 | XPathFactory xpathFactory = new XPathFactoryFinder(classLoader).newFactory(uri); | |
150 | if (xpathFactory == null) { | |
151 | throw new XPathFactoryConfigurationException( | |
152 | "No XPathFctory implementation found for the object model: " | |
153 | + uri | |
154 | ); | |
155 | } | |
156 | return xpathFactory; | |
157 | } | |
158 | ||
159 | /** | |
160 | * @return Instance of an <code>XPathFactory</code>. | |
161 | * | |
162 | * @throws XPathFactoryConfigurationException If the specified object model is unavailable. | |
163 | * @throws NullPointerException If <code>uri</code> is <code>null</code>. | |
164 | * @throws IllegalArgumentException If <code>uri.length() == 0</code>. | |
165 | */ | |
166 | public static XPathFactory newInstance(String uri, String factoryClassName, | |
167 | ClassLoader classLoader) throws XPathFactoryConfigurationException { | |
168 | if (uri == null) { | |
169 | throw new NullPointerException( | |
170 | "XPathFactory#newInstance(String uri) cannot be called with uri == null" | |
171 | ); | |
172 | } | |
173 | if (uri.length() == 0) { | |
174 | throw new IllegalArgumentException( | |
175 | "XPathFactory#newInstance(String uri) cannot be called with uri == \"\"" | |
176 | ); | |
177 | } | |
178 | if (factoryClassName == null) { | |
179 | throw new XPathFactoryConfigurationException("factoryClassName cannot be null."); | |
180 | } | |
181 | if (classLoader == null) { | |
182 | classLoader = SecuritySupport.getContextClassLoader(); | |
183 | } | |
184 | XPathFactory xpathFactory = new XPathFactoryFinder(classLoader).createInstance(factoryClassName); | |
185 | if (xpathFactory == null || !xpathFactory.isObjectModelSupported(uri)) { | |
186 | throw new XPathFactoryConfigurationException( | |
187 | "No XPathFctory implementation found for the object model: " | |
188 | + uri | |
189 | ); | |
190 | } | |
191 | return xpathFactory; | |
163 | 192 | } |
164 | 193 | |
165 | 194 | /** |
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | // $Id: XPathFactoryFinder.java 670433 2008-06-23 02:02:24Z mrglavas $ | |
16 | // $Id: XPathFactoryFinder.java 670432 2008-06-23 02:02:08Z mrglavas $ | |
17 | 17 | |
18 | 18 | package javax.xml.xpath; |
19 | 19 | |
35 | 35 | * Implementation of {@link XPathFactory#newInstance(String)}. |
36 | 36 | * |
37 | 37 | * @author <a href="Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a> |
38 | * @version $Revision: 670433 $, $Date: 2008-06-22 22:02:24 -0400 (Sun, 22 Jun 2008) $ | |
38 | * @version $Revision: 670432 $, $Date: 2008-06-22 22:02:08 -0400 (Sun, 22 Jun 2008) $ | |
39 | 39 | * @since 1.5 |
40 | 40 | */ |
41 | 41 | final class XPathFactoryFinder { |
265 | 265 | * @return null |
266 | 266 | * if it fails. Error messages will be printed by this method. |
267 | 267 | */ |
268 | private XPathFactory createInstance( String className ) { | |
268 | XPathFactory createInstance( String className ) { | |
269 | 269 | try { |
270 | 270 | if (debug) debugPrintln("instanciating "+className); |
271 | 271 | Class clazz; |
3 | 3 | Name: org/apache/xmlcommons/Version |
4 | 4 | Comment: XmlCommonsExternal for http://xml.apache.org/ subproject's use |
5 | 5 | Implementation-Title: org.apache.xmlcommons.Version |
6 | Implementation-Version: 1.3.05 | |
6 | Implementation-Version: 1.4.01 | |
7 | 7 | Implementation-Vendor: Apache Software Foundation |
8 | 8 | Implementation-URL: http://xml.apache.org/commons/ |
9 | 9 | |
37 | 37 | Implementation-Vendor: World Wide Web Consortium |
38 | 38 | Implementation-URL: http://www.w3c.org/DOM/ |
39 | 39 | |
40 | Name: javax/xml/stream/ | |
41 | Comment: xml-commons for http://xml.apache.org/ subproject's use | |
42 | Specification-Title: Streaming API for XML (StAX) 1.0 | |
43 | Specification-Vendor: BEA Systems, Inc. | |
44 | Specification-Version: 1.0 | |
45 | Implementation-Title: javax.xml.stream | |
46 | Implementation-Version: 1.4.01 | |
47 | Implementation-Vendor: Apache Software Foundation | |
48 | Implementation-URL: http://xml.apache.org/commons/ | |
49 | ||
50 | Name: javax/xml/datatype/ | |
51 | Comment: xml-commons for http://xml.apache.org/ subproject's use | |
52 | Specification-Title: Java API for XML Processing (JAXP) 1.4 | |
53 | Specification-Vendor: Sun Microsystems Inc. | |
54 | Specification-Version: 1.4 | |
55 | Implementation-Title: javax.xml.datatype | |
56 | Implementation-Version: 1.4.01 | |
57 | Implementation-Vendor: Apache Software Foundation | |
58 | Implementation-URL: http://xml.apache.org/commons/ | |
59 | ||
60 | Name: javax/xml/namespace/ | |
61 | Comment: xml-commons for http://xml.apache.org/ subproject's use | |
62 | Specification-Title: Java API for XML Processing (JAXP) 1.4 | |
63 | Specification-Vendor: Sun Microsystems Inc. | |
64 | Specification-Version: 1.4 | |
65 | Implementation-Title: javax.xml.namespace | |
66 | Implementation-Version: 1.4.01 | |
67 | Implementation-Vendor: Apache Software Foundation | |
68 | Implementation-URL: http://xml.apache.org/commons/ | |
69 | ||
40 | 70 | Name: javax/xml/parsers/ |
41 | 71 | Comment: xml-commons for http://xml.apache.org/ subproject's use |
42 | Specification-Title: JSR 206, Java API for XML Processing 1.3 | |
43 | Specification-Version: 1.3 | |
72 | Specification-Title: Java API for XML Processing (JAXP) 1.4 | |
44 | 73 | Specification-Vendor: Sun Microsystems Inc. |
74 | Specification-Version: 1.4 | |
45 | 75 | Implementation-Title: javax.xml.parsers |
46 | Implementation-Version: 1.3.05 | |
76 | Implementation-Version: 1.4.01 | |
47 | 77 | Implementation-Vendor: Apache Software Foundation |
48 | 78 | Implementation-URL: http://xml.apache.org/commons/ |
49 | 79 | |
50 | 80 | Name: javax/xml/transform/ |
51 | 81 | Comment: xml-commons for http://xml.apache.org/ subproject's use |
52 | Specification-Title: JSR 206 Java API for XML Processing 1.3 | |
53 | Specification-Version: 1.3 | |
82 | Specification-Title: Java API for XML Processing (JAXP) 1.4 | |
54 | 83 | Specification-Vendor: Sun Microsystems Inc. |
84 | Specification-Version: 1.4 | |
55 | 85 | Implementation-Title: javax.xml.transform |
56 | Implementation-Version: 1.3.05 | |
86 | Implementation-Version: 1.4.01 | |
57 | 87 | Implementation-Vendor: Apache Software Foundation |
58 | 88 | Implementation-URL: http://xml.apache.org/commons/ |
59 | 89 | |
60 | 90 | Name: javax/xml/validation/ |
61 | 91 | Comment: xml-commons for http://xml.apache.org/ subproject's use |
62 | Specification-Title: JSR 206 Java API for XML Processing 1.3 | |
63 | Specification-Version: 1.3 | |
92 | Specification-Title: Java API for XML Processing (JAXP) 1.4 | |
64 | 93 | Specification-Vendor: Sun Microsystems Inc. |
94 | Specification-Version: 1.4 | |
65 | 95 | Implementation-Title: javax.xml.validation |
66 | Implementation-Version: 1.3.05 | |
67 | Implementation-Vendor: Apache Software Foundation | |
68 | Implementation-URL: http://xml.apache.org/commons/ | |
69 | ||
70 | Name: javax/xml/datatype/ | |
71 | Comment: xml-commons for http://xml.apache.org/ subproject's use | |
72 | Specification-Title: JSR 206 Java API for XML Processing 1.3 | |
73 | Specification-Version: 1.3 | |
74 | Specification-Vendor: Sun Microsystems Inc. | |
75 | Implementation-Title: javax.xml.datatype | |
76 | Implementation-Version: 1.3.05 | |
96 | Implementation-Version: 1.4.01 | |
77 | 97 | Implementation-Vendor: Apache Software Foundation |
78 | 98 | Implementation-URL: http://xml.apache.org/commons/ |
79 | 99 | |
80 | 100 | Name: javax/xml/xpath/ |
81 | 101 | Comment: xml-commons for http://xml.apache.org/ subproject's use |
82 | Specification-Title: JSR 206 Java API for XML Processing 1.3 | |
83 | Specification-Version: 1.3 | |
102 | Specification-Title: Java API for XML Processing (JAXP) 1.4 | |
84 | 103 | Specification-Vendor: Sun Microsystems Inc. |
104 | Specification-Version: 1.4 | |
85 | 105 | Implementation-Title: javax.xml.xpath |
86 | Implementation-Version: 1.3.05 | |
106 | Implementation-Version: 1.4.01 | |
87 | 107 | Implementation-Vendor: Apache Software Foundation |
88 | 108 | Implementation-URL: http://xml.apache.org/commons/ |
89 |
56 | 56 | */ |
57 | 57 | public static String getVersionNum() |
58 | 58 | { |
59 | return "1.3.05"; | |
59 | return "1.4.01"; | |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
0 | /* | |
1 | * Copyright (c) 2009 World Wide Web Consortium, | |
2 | * | |
3 | * (Massachusetts Institute of Technology, European Research Consortium for | |
4 | * Informatics and Mathematics, Keio University). All Rights Reserved. This | |
5 | * work is distributed under the W3C(r) Software License [1] in the hope that | |
6 | * it will be useful, but WITHOUT ANY WARRANTY; without even the implied | |
7 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
8 | * | |
9 | * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 | |
10 | */ | |
11 | ||
12 | package org.w3c.dom; | |
13 | ||
14 | /** | |
15 | * The <code>ElementTraversal</code> interface is a set of read-only attributes | |
16 | * which allow an author to easily navigate between elements in a document. | |
17 | * <p>In conforming implementations of Element Traversal, all objects that | |
18 | * implement {@link Element} must also implement the | |
19 | * <code>ElementTraversal</code> interface. Four of the methods, | |
20 | * {@link #getFirstElementChild}, {@link #getLastElementChild}, | |
21 | * {@link #getPreviousElementSibling}, and {@link #getNextElementSibling}, | |
22 | * each return a live reference to another element with the defined | |
23 | * relationship to the current element, if the related element exists. The | |
24 | * fifth method, {@link #getChildElementCount}, exposes the number of child | |
25 | * elements of an element, for preprocessing before navigation. | |
26 | * <p>See also the | |
27 | * <a href='http://www.w3.org/TR/ElementTraversal/'><cite>Element Traversal Specification</cite></a>. | |
28 | */ | |
29 | public interface ElementTraversal { | |
30 | ||
31 | /** | |
32 | * Returns the first child element node of this element. <code>null</code> | |
33 | * if this element has no child elements. | |
34 | */ | |
35 | Element getFirstElementChild(); | |
36 | ||
37 | /** | |
38 | * Returns the last child element node of this element. <code>null</code> | |
39 | * if this element has no child elements. | |
40 | */ | |
41 | Element getLastElementChild(); | |
42 | ||
43 | /** | |
44 | * Returns the previous sibling element node of this element. | |
45 | * <code>null</code> if this element has no element sibling nodes that | |
46 | * come before this one in the document tree. | |
47 | */ | |
48 | Element getPreviousElementSibling(); | |
49 | ||
50 | /** | |
51 | * Returns the next sibling element node of this element. | |
52 | * <code>null</code> if this element has no element sibling nodes that | |
53 | * come after this one in the document tree. | |
54 | */ | |
55 | Element getNextElementSibling(); | |
56 | ||
57 | /** | |
58 | * Returns the current number of element nodes that are children of this | |
59 | * element. <code>0</code> if this element has no child nodes that are of | |
60 | * <code>nodeType</code> <code>1</code>. | |
61 | */ | |
62 | int getChildElementCount(); | |
63 | } |
2 | 2 | // Written by Edwin Goei, edwingo@apache.org |
3 | 3 | // and by David Brownell, dbrownell@users.sourceforge.net |
4 | 4 | // NO WARRANTY! This class is in the Public Domain. |
5 | // $Id: NewInstance.java 670297 2008-06-22 01:57:58Z mrglavas $ | |
5 | // $Id: NewInstance.java 670295 2008-06-22 01:46:43Z mrglavas $ | |
6 | 6 | |
7 | 7 | package org.xml.sax.helpers; |
8 | 8 |
0 | 0 | //SAX parser factory. |
1 | 1 | //http://www.saxproject.org |
2 | 2 | //No warranty; no copyright -- use this as you will. |
3 | //$Id: ParserFactory.java 670297 2008-06-22 01:57:58Z mrglavas $ | |
3 | //$Id: ParserFactory.java 670295 2008-06-22 01:46:43Z mrglavas $ | |
4 | 4 | |
5 | 5 | package org.xml.sax.helpers; |
6 | 6 |
2 | 2 | // Written by David Megginson |
3 | 3 | // and by David Brownell |
4 | 4 | // NO WARRANTY! This class is in the Public Domain. |
5 | // $Id: XMLReaderFactory.java 670297 2008-06-22 01:57:58Z mrglavas $ | |
5 | // $Id: XMLReaderFactory.java 670295 2008-06-22 01:46:43Z mrglavas $ | |
6 | 6 | |
7 | 7 | package org.xml.sax.helpers; |
8 | 8 | import java.io.BufferedReader; |