Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]

    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/#string">xs:string</a> type.
   24    * <p>
   25    * A basic string in XML schema is not whitespace normalized.  If you
   26    * want your string type to be insensitive to variations in runs of
   27    * whitespace, consider using 
   28    * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#token">xs:token</a>
   29    * (aka {@link XmlToken}) instead.
   30    * To forbid whitespace and permit just alphanumeric and other
   31    * common identifier characters consider
   32    * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NMTOKEN">xs:NMTOKEN</a>
   33    * (aka {@link XmlNMTOKEN}) instead.
   34    * <p>
   35    * Convertible to {@link String}.
   36    */ 
   37   public interface XmlString extends XmlAnySimpleType
   38   {
   39       /** The constant {@link SchemaType} object representing this schema type. */
   40       public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_string");
   41       
   42       /**
   43        * A class with methods for creating instances
   44        * of {@link XmlString}.
   45        */
   46       public static final class Factory
   47       {
   48           /** Creates an empty instance of {@link XmlString} */
   49           public static XmlString newInstance() {
   50             return (XmlString) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
   51           
   52           /** Creates an empty instance of {@link XmlString} */
   53           public static XmlString newInstance(org.apache.xmlbeans.XmlOptions options) {
   54             return (XmlString) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
   55           
   56           /** Creates an immutable {@link XmlString} value */
   57           public static XmlString newValue(Object obj) {
   58             return (XmlString) type.newValue( obj ); }
   59           
   60           /** Parses a {@link XmlString} fragment from a String. For example: "<code>&lt;xml-fragment&gt; arbitrary string &lt;/xml-fragment&gt;</code>". */
   61           public static XmlString parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
   62             return (XmlString) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
   63           
   64           /** Parses a {@link XmlString} fragment from a String. For example: "<code>&lt;xml-fragment&gt; arbitrary string &lt;/xml-fragment&gt;</code>". */
   65           public static XmlString parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
   66             return (XmlString) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
   67           
   68           /** Parses a {@link XmlString} fragment from a File. */
   69           public static XmlString parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   70             return (XmlString) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
   71           
   72           /** Parses a {@link XmlString} fragment from a File. */
   73           public static XmlString parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   74             return (XmlString) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
   75           
   76           /** Parses a {@link XmlString} fragment from a URL. */
   77           public static XmlString parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   78             return (XmlString) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
   79   
   80           /** Parses a {@link XmlString} fragment from a URL. */
   81           public static XmlString parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   82             return (XmlString) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
   83   
   84           /** Parses a {@link XmlString} fragment from an InputStream. */
   85           public static XmlString parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   86             return (XmlString) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
   87           
   88           /** Parses a {@link XmlString} fragment from an InputStream. */
   89           public static XmlString parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   90             return (XmlString) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
   91           
   92           /** Parses a {@link XmlString} fragment from a Reader. */
   93           public static XmlString parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   94             return (XmlString) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
   95           
   96           /** Parses a {@link XmlString} fragment from a Reader. */
   97           public static XmlString parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   98             return (XmlString) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
   99           
  100           /** Parses a {@link XmlString} fragment from a DOM Node. */
  101           public static XmlString parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
  102             return (XmlString) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
  103           
  104           /** Parses a {@link XmlString} fragment from a DOM Node. */
  105           public static XmlString parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
  106             return (XmlString) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
  107           
  108           /** Parses a {@link XmlString} fragment from an XMLInputStream.
  109            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  110            */
  111           public static XmlString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  112             return (XmlString) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
  113           
  114           /** Parses a {@link XmlString} fragment from an XMLInputStream.
  115            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  116            */
  117           public static XmlString 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 (XmlString) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
  119           
  120           /** Parses a {@link XmlString} fragment from an XMLStreamReader. */
  121           public static XmlString parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
  122             return (XmlString) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); }
  123           
  124           /** Parses a {@link XmlString} fragment from an XMLStreamReader. */
  125           public static XmlString parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{
  126             return (XmlString) 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   

Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]