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/#IDREF">xs:IDREF</a> type. 24 * <p> 25 * When validated, IDREF values must match an ID value that is present within 26 * the document. This rule is only verified when a whole document is validated 27 * at once. 28 * <p> 29 * Convertible to a {@link String}. 30 */ 31 public interface XmlIDREF extends XmlNCName 32 { 33 /** The constant {@link SchemaType} object representing this schema type. */ 34 public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_IDREF"); 35 36 /** 37 * A class with methods for creating instances 38 * of {@link XmlIDREF}. 39 */ 40 public static final class Factory 41 { 42 /** Creates an empty instance of {@link XmlIDREF} */ 43 public static XmlIDREF newInstance() { 44 return (XmlIDREF) XmlBeans.getContextTypeLoader().newInstance( type, null ); } 45 46 /** Creates an empty instance of {@link XmlIDREF} */ 47 public static XmlIDREF newInstance(org.apache.xmlbeans.XmlOptions options) { 48 return (XmlIDREF) XmlBeans.getContextTypeLoader().newInstance( type, options ); } 49 50 /** Creates an immutable {@link XmlIDREF} value */ 51 public static XmlIDREF newValue(Object obj) { 52 return (XmlIDREF) type.newValue( obj ); } 53 54 /** Parses a {@link XmlIDREF} fragment from a String. */ 55 public static XmlIDREF parse(java.lang.String s) throws org.apache.xmlbeans.XmlException { 56 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( s, type, null ); } 57 58 /** Parses a {@link XmlIDREF} fragment from a String. */ 59 public static XmlIDREF parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 60 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( s, type, options ); } 61 62 /** Parses a {@link XmlIDREF} fragment from a File. */ 63 public static XmlIDREF parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException { 64 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( f, type, null ); } 65 66 /** Parses a {@link XmlIDREF} fragment from a File. */ 67 public static XmlIDREF parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 68 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( f, type, options ); } 69 70 /** Parses a {@link XmlIDREF} fragment from a URL. */ 71 public static XmlIDREF parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { 72 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( u, type, null ); } 73 74 /** Parses a {@link XmlIDREF} fragment from a URL. */ 75 public static XmlIDREF parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 76 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( u, type, options ); } 77 78 /** Parses a {@link XmlIDREF} fragment from an InputStream. */ 79 public static XmlIDREF parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { 80 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( is, type, null ); } 81 82 /** Parses a {@link XmlIDREF} fragment from an InputStream. */ 83 public static XmlIDREF parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 84 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( is, type, options ); } 85 86 /** Parses a {@link XmlIDREF} fragment from a Reader. */ 87 public static XmlIDREF parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { 88 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( r, type, null ); } 89 90 /** Parses a {@link XmlIDREF} fragment from a Reader. */ 91 public static XmlIDREF parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 92 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( r, type, options ); } 93 94 /** Parses a {@link XmlIDREF} fragment from a DOM Node. */ 95 public static XmlIDREF parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { 96 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( node, type, null ); } 97 98 /** Parses a {@link XmlIDREF} fragment from a DOM Node. */ 99 public static XmlIDREF parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 100 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( node, type, options ); } 101 102 /** Parses a {@link XmlIDREF} fragment from an XMLInputStream. 103 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 104 */ 105 public static XmlIDREF parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 106 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( xis, type, null ); } 107 108 /** Parses a {@link XmlIDREF} fragment from an XMLInputStream. 109 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 110 */ 111 public static XmlIDREF parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 112 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( xis, type, options ); } 113 114 /** Parses a {@link XmlIDREF} fragment from an XMLStreamReader. */ 115 public static XmlIDREF parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException { 116 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); } 117 118 /** Parses a {@link XmlIDREF} fragment from an XMLStreamReader. */ 119 public static XmlIDREF parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{ 120 return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); } 121 122 /** Returns a validating XMLInputStream. 123 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 124 */ 125 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 { 126 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } 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, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 132 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } 133 134 private Factory() { } // No instance of this class allowed 135 } 136 } 137