1 /* Copyright 2004 The Apache Software Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 package org.apache.xmlbeans;
17
18 import javax.xml.stream.XMLStreamReader;
19
20
21 /**
22 * Corresponds to the XML Schema
23 * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#normalizedString">xs:normalizedString</a> type.
24 * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a>.
25 * <p>
26 * An normalizedString simply is a string where all the carriage return,
27 * linefeed, and tab characters have been normalized (switched to) ordinary
28 * space characters. Use normalizedString for long strings to make them
29 * insensitive to line breaking. If you wish to often be insensitive to
30 * runs of whitespace (as is often the case), use
31 * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#token">xs:token</a>
32 * (aka {@link XmlToken}) instead.
33 * <p>
34 * Convertible to {@link String}. When obtaining the stringValue, the
35 * whitespace-normalized value is returned.
36 */
37 public interface XmlNormalizedString extends XmlString
38 {
39 /** The constant {@link SchemaType} object representing this schema type. */
40 public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_normalizedString");
41
42 /**
43 * A class with methods for creating instances
44 * of {@link XmlNormalizedString}.
45 */
46 public static final class Factory
47 {
48 /** Creates an empty instance of {@link XmlNormalizedString} */
49 public static XmlNormalizedString newInstance() {
50 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
51
52 /** Creates an empty instance of {@link XmlNormalizedString} */
53 public static XmlNormalizedString newInstance(org.apache.xmlbeans.XmlOptions options) {
54 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
55
56 /** Creates an immutable {@link XmlNormalizedString} value */
57 public static XmlNormalizedString newValue(Object obj) {
58 return (XmlNormalizedString) type.newValue( obj ); }
59
60 /** Parses a {@link XmlNormalizedString} fragment from a String. For example: "<code><xml-fragment> string to normalize </xml-fragment></code>". */
61 public static XmlNormalizedString parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
62 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
63
64 /** Parses a {@link XmlNormalizedString} fragment from a String. For example: "<code><xml-fragment> string to normalize </xml-fragment></code>". */
65 public static XmlNormalizedString parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
66 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
67
68 /** Parses a {@link XmlNormalizedString} fragment from a File. */
69 public static XmlNormalizedString parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
70 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
71
72 /** Parses a {@link XmlNormalizedString} fragment from a File. */
73 public static XmlNormalizedString parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
74 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
75
76 /** Parses a {@link XmlNormalizedString} fragment from a URL. */
77 public static XmlNormalizedString parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
78 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
79
80 /** Parses a {@link XmlNormalizedString} fragment from a URL. */
81 public static XmlNormalizedString parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
82 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
83
84 /** Parses a {@link XmlNormalizedString} fragment from an InputStream. */
85 public static XmlNormalizedString parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
86 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
87
88 /** Parses a {@link XmlNormalizedString} fragment from an InputStream. */
89 public static XmlNormalizedString parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
90 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
91
92 /** Parses a {@link XmlNormalizedString} fragment from a Reader. */
93 public static XmlNormalizedString parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
94 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
95
96 /** Parses a {@link XmlNormalizedString} fragment from a Reader. */
97 public static XmlNormalizedString parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
98 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
99
100 /** Parses a {@link XmlNormalizedString} fragment from a DOM Node. */
101 public static XmlNormalizedString parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
102 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
103
104 /** Parses a {@link XmlNormalizedString} fragment from a DOM Node. */
105 public static XmlNormalizedString parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
106 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
107
108 /** Parses a {@link XmlNormalizedString} fragment from an XMLInputStream.
109 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
110 */
111 public static XmlNormalizedString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
112 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
113
114 /** Parses a {@link XmlNormalizedString} fragment from an XMLInputStream.
115 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
116 */
117 public static XmlNormalizedString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
118 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
119
120 /** Parses a {@link XmlNormalizedString} fragment from an XMLStreamReader. */
121 public static XmlNormalizedString parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
122 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); }
123
124 /** Parses a {@link XmlNormalizedString} fragment from an XMLStreamReader. */
125 public static XmlNormalizedString parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
126 return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); }
127
128 /** Returns a validating XMLInputStream.
129 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
130 */
131 public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
132 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
133
134 /** Returns a validating XMLInputStream.
135 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
136 */
137 public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
138 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
139
140 private Factory() { } // No instance of this class allowed
141 }
142 }
143