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   import javax.xml.namespace.QName;
   22   
   23   
   24   /**
   25    * Corresponds to the XML Schema
   26    * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#QName">xs:QName</a> type.
   27    * <p>
   28    * A QName is the logical combination of an XML namespace URI and a localName.
   29    * Although in an XML instance document, a QName appears as "prefix:localName",
   30    * the logical value of a QName does NOT contain any information about the
   31    * prefix, only the namespace URI to which the prefix maps.  For example,
   32    * two QNames "a:hello" and "b:hello" are perfectly equivalent if "a:" in
   33    * the first instance maps to the same URI as "b:" in the second instance.
   34    * <p>
   35    * Convertible to {@link javax.xml.namespace.QName}.
   36    */ 
   37   public interface XmlQName extends XmlAnySimpleType
   38   {
   39       /** The constant {@link SchemaType} object representing this schema type. */
   40       public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_QName");
   41       
   42       /** Returns this value as a {@link QName} */
   43       QName getQNameValue();
   44       /** Sets this value as a {@link QName} */
   45       void setQNameValue(QName name);
   46   
   47       /**
   48        * Returns this value as a {@link QName}
   49        * @deprecated replaced with {@link #getQNameValue}
   50        **/
   51       QName qNameValue();
   52       /**
   53        * Sets this value as a {@link QName}
   54        * @deprecated replaced with {@link #setQNameValue}
   55        **/
   56       void set(QName name);
   57       
   58       /**
   59        * A class with methods for creating instances
   60        * of {@link XmlQName}.
   61        */
   62       public static final class Factory
   63       {
   64           /** Creates an empty instance of {@link XmlQName} */
   65           public static XmlQName newInstance() {
   66             return (XmlQName) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
   67           
   68           /** Creates an empty instance of {@link XmlQName} */
   69           public static XmlQName newInstance(org.apache.xmlbeans.XmlOptions options) {
   70             return (XmlQName) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
   71           
   72           /** Creates an immutable {@link XmlQName} value */
   73           public static XmlQName newValue(Object obj) {
   74             return (XmlQName) type.newValue( obj ); }
   75           
   76           /** Parses a {@link XmlQName} fragment from a String. For example: "<code>&lt;xml-fragment xmlns:x="http://openuri.org/"&gt;x:sample&lt;/xml-fragment&gt;</code>". */
   77           public static XmlQName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
   78             return (XmlQName) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
   79           
   80           /** Parses a {@link XmlQName} fragment from a String. For example: "<code>&lt;xml-fragment xmlns:x="http://openuri.org/"&gt;x:sample&lt;/xml-fragment&gt;</code>". */
   81           public static XmlQName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
   82             return (XmlQName) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
   83           
   84           /** Parses a {@link XmlQName} fragment from a File. */
   85           public static XmlQName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   86             return (XmlQName) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
   87           
   88           /** Parses a {@link XmlQName} fragment from a File. */
   89           public static XmlQName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   90             return (XmlQName) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
   91           
   92           /** Parses a {@link XmlQName} fragment from a URL. */
   93           public static XmlQName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   94             return (XmlQName) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
   95   
   96           /** Parses a {@link XmlQName} fragment from a URL. */
   97           public static XmlQName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
   98             return (XmlQName) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
   99   
  100           /** Parses a {@link XmlQName} fragment from an InputStream. */
  101           public static XmlQName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  102             return (XmlQName) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
  103           
  104           /** Parses a {@link XmlQName} fragment from an InputStream. */
  105           public static XmlQName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  106             return (XmlQName) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
  107           
  108           /** Parses a {@link XmlQName} fragment from a Reader. */
  109           public static XmlQName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  110             return (XmlQName) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
  111           
  112           /** Parses a {@link XmlQName} fragment from a Reader. */
  113           public static XmlQName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  114             return (XmlQName) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
  115           
  116           /** Parses a {@link XmlQName} fragment from a DOM Node. */
  117           public static XmlQName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
  118             return (XmlQName) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
  119           
  120           /** Parses a {@link XmlQName} fragment from a DOM Node. */
  121           public static XmlQName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
  122             return (XmlQName) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
  123           
  124           /** Parses a {@link XmlQName} fragment from an XMLInputStream.
  125            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  126            */
  127           public static XmlQName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  128             return (XmlQName) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
  129           
  130           /** Parses a {@link XmlQName} fragment from an XMLInputStream.
  131            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  132            */
  133           public static XmlQName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  134             return (XmlQName) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
  135           
  136           /** Parses a {@link XmlQName} fragment from an XMLStreamReader. */
  137           public static XmlQName parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
  138             return (XmlQName) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); }
  139           
  140           /** Parses a {@link XmlQName} fragment from an XMLStreamReader. */
  141           public static XmlQName parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{
  142             return (XmlQName) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); }
  143           
  144           /** Returns a validating XMLInputStream.
  145            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  146            */
  147           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 {
  148             return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
  149           
  150           /** Returns a validating XMLInputStream.
  151            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  152            */
  153           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 {
  154             return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
  155           
  156           private Factory() { } // No instance of this class allowed
  157       }
  158   }
  159   

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