src/javax/xml/datatype/DatatypeFactory.java

Print this page

        

*** 23,57 **** * questions. */ package javax.xml.datatype; - import java.math.BigInteger; import java.math.BigDecimal; import java.util.GregorianCalendar; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * <p>Factory that creates new <code>javax.xml.datatype</code> <code>Object</code>s that map XML to/from Java <code>Object</code>s.</p> * ! * <p><a name="DatatypeFactory.newInstance"/>{@link #newInstance()} is used to create a new <code>DatatypeFactory</code>. ! * The following implementation resolution mechanisms are used in the following order:</p> * <ol> * <li> * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "<code>javax.xml.datatype.DatatypeFactory</code>", ! * exists, a class with the name of the property's value is instantiated. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. * </li> * <li> * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>. * The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step * and processed as documented in the prior step. * </li> * <li> ! * The services resolution mechanism is used, e.g. <code>META-INF/services/java.xml.datatype.DatatypeFactory</code>. ! * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. * </li> * <li> * The final mechanism is to attempt to instantiate the <code>Class</code> specified by * {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. --- 23,61 ---- * questions. */ package javax.xml.datatype; import java.math.BigDecimal; + import java.math.BigInteger; import java.util.GregorianCalendar; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * <p>Factory that creates new <code>javax.xml.datatype</code> <code>Object</code>s that map XML to/from Java <code>Object</code>s.</p> * ! * <p>A new instance of the <code>DatatypeFactory</code> is created through the {@link #newInstance()} method ! * that uses the following implementation resolution mechanisms to determine an implementation:</p> * <ol> * <li> * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "<code>javax.xml.datatype.DatatypeFactory</code>", ! * exists, a class with the name of the property value is instantiated. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. * </li> * <li> * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>. * The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step * and processed as documented in the prior step. * </li> * <li> ! * Uses the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, to attempt ! * to locate and load an implementation of the service. ! * <br> ! * In case of {@link java.util.ServiceConfigurationError service ! * configuration error} a {@link javax.xml.datatype.DatatypeConfigurationException} ! * will be thrown. * </li> * <li> * The final mechanism is to attempt to instantiate the <code>Class</code> specified by * {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*** 70,80 **** /** * <p>Default property name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.</p> * * <p>Default value is <code>javax.xml.datatype.DatatypeFactory</code>.</p> */ ! public static final String DATATYPEFACTORY_PROPERTY = "javax.xml.datatype.DatatypeFactory"; /** * <p>Default implementation class name as defined in * <em>JSR 206: Java(TM) API for XML Processing (JAXP) 1.3</em>.</p> * --- 74,85 ---- /** * <p>Default property name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.</p> * * <p>Default value is <code>javax.xml.datatype.DatatypeFactory</code>.</p> */ ! public static final String DATATYPEFACTORY_PROPERTY = ! DatatypeFactory.class.getName(); /** * <p>Default implementation class name as defined in * <em>JSR 206: Java(TM) API for XML Processing (JAXP) 1.3</em>.</p> *
*** 84,94 **** * * <p>Users should not refer to this field; it is intended only to * document a factory implementation detail. * </p> */ ! public static final String DATATYPEFACTORY_IMPLEMENTATION_CLASS = new String("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl"); /** * http://www.w3.org/TR/xpath-datamodel/#xdtschema defines two regexps * to constrain the value space of dayTimeDuration ([^YM]*[DT].*) * and yearMonthDuration ([^DT]*). Note that these expressions rely on --- 89,100 ---- * * <p>Users should not refer to this field; it is intended only to * document a factory implementation detail. * </p> */ ! public static final String DATATYPEFACTORY_IMPLEMENTATION_CLASS = ! "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl"; /** * http://www.w3.org/TR/xpath-datamodel/#xdtschema defines two regexps * to constrain the value space of dayTimeDuration ([^YM]*[DT].*) * and yearMonthDuration ([^DT]*). Note that these expressions rely on
*** 123,141 **** * @see #newInstance(String factoryClassName, ClassLoader classLoader) */ public static DatatypeFactory newInstance() throws DatatypeConfigurationException { ! try { ! return (DatatypeFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ ! DATATYPEFACTORY_PROPERTY, /* The fallback implementation class name */ DATATYPEFACTORY_IMPLEMENTATION_CLASS); - } catch (FactoryFinder.ConfigurationError e) { - throw new DatatypeConfigurationException(e.getMessage(), e.getException()); - } } /** * <p>Obtain a new instance of a <code>DatatypeFactory</code> from class name. * This function is useful when there are multiple providers in the classpath. --- 129,143 ---- * @see #newInstance(String factoryClassName, ClassLoader classLoader) */ public static DatatypeFactory newInstance() throws DatatypeConfigurationException { ! return FactoryFinder.find( /* The default property name according to the JAXP spec */ ! DatatypeFactory.class, /* The fallback implementation class name */ DATATYPEFACTORY_IMPLEMENTATION_CLASS); } /** * <p>Obtain a new instance of a <code>DatatypeFactory</code> from class name. * This function is useful when there are multiple providers in the classpath.
*** 170,184 **** * * @since 1.6 */ public static DatatypeFactory newInstance(String factoryClassName, ClassLoader classLoader) throws DatatypeConfigurationException { ! try { ! return (DatatypeFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); ! } catch (FactoryFinder.ConfigurationError e) { ! throw new DatatypeConfigurationException(e.getMessage(), e.getException()); ! } } /** * <p>Obtain a new instance of a <code>Duration</code> * specifying the <code>Duration</code> as its string representation, "PnYnMnDTnHnMnS", --- 172,183 ---- * * @since 1.6 */ public static DatatypeFactory newInstance(String factoryClassName, ClassLoader classLoader) throws DatatypeConfigurationException { ! return FactoryFinder.newInstance(DatatypeFactory.class, ! factoryClassName, classLoader, false); } /** * <p>Obtain a new instance of a <code>Duration</code> * specifying the <code>Duration</code> as its string representation, "PnYnMnDTnHnMnS",
*** 190,200 **** * The value space of duration is a six-dimensional space where the coordinates designate the * Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. * These components are ordered in their significance by their order of appearance i.e. as * year, month, day, hour, minute, and second. * </blockquote> ! * <p>All six values are set and availabe from the created {@link Duration}</p> * * <p>The XML Schema specification states that values can be of an arbitrary size. * Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. * An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits * if implementation capacities are exceeded.</p> --- 189,199 ---- * The value space of duration is a six-dimensional space where the coordinates designate the * Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. * These components are ordered in their significance by their order of appearance i.e. as * year, month, day, hour, minute, and second. * </blockquote> ! * <p>All six values are set and available from the created {@link Duration}</p> * * <p>The XML Schema specification states that values can be of an arbitrary size. * Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. * An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits * if implementation capacities are exceeded.</p>
*** 220,230 **** * Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. * These components are ordered in their significance by their order of appearance i.e. as * year, month, day, hour, minute, and second. * </blockquote> * <p>All six values are set by computing their values from the specified milliseconds ! * and are availabe using the <code>get</code> methods of the created {@link Duration}. * The values conform to and are defined by:</p> * <ul> * <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> * <li><a href="http://www.w3.org/TR/xmlschema-2/#isoformats"> * W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</a> --- 219,229 ---- * Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. * These components are ordered in their significance by their order of appearance i.e. as * year, month, day, hour, minute, and second. * </blockquote> * <p>All six values are set by computing their values from the specified milliseconds ! * and are available using the <code>get</code> methods of the created {@link Duration}. * The values conform to and are defined by:</p> * <ul> * <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> * <li><a href="http://www.w3.org/TR/xmlschema-2/#isoformats"> * W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</a>
*** 356,366 **** * * <p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only day, hour, minute, and second components. * This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p> * ! * <p>All four values are set and availabe from the created {@link Duration}</p> * * <p>The XML Schema specification states that values can be of an arbitrary size. * Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. * An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits * if implementation capacities are exceeded.</p> --- 355,365 ---- * * <p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only day, hour, minute, and second components. * This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p> * ! * <p>All four values are set and available from the created {@link Duration}</p> * * <p>The XML Schema specification states that values can be of an arbitrary size. * Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. * An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits * if implementation capacities are exceeded.</p>
*** 401,411 **** * <p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only day, hour, minute, and second components. * This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p> * * <p>All four values are set by computing their values from the specified milliseconds ! * and are availabe using the <code>get</code> methods of the created {@link Duration}. * The values conform to and are defined by:</p> * <ul> * <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> * <li><a href="http://www.w3.org/TR/xmlschema-2/#isoformats"> * W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</a> --- 400,410 ---- * <p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only day, hour, minute, and second components. * This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p> * * <p>All four values are set by computing their values from the specified milliseconds ! * and are available using the <code>get</code> methods of the created {@link Duration}. * The values conform to and are defined by:</p> * <ul> * <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> * <li><a href="http://www.w3.org/TR/xmlschema-2/#isoformats"> * W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</a>
*** 533,543 **** * * <p>The datatype <code>xdt:yearMonthDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only year and month components. * This datatype resides in the namespace {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.</p> * ! * <p>Both values are set and availabe from the created {@link Duration}</p> * * <p>The XML Schema specification states that values can be of an arbitrary size. * Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. * An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits * if implementation capacities are exceeded.</p> --- 532,542 ---- * * <p>The datatype <code>xdt:yearMonthDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only year and month components. * This datatype resides in the namespace {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.</p> * ! * <p>Both values are set and available from the created {@link Duration}</p> * * <p>The XML Schema specification states that values can be of an arbitrary size. * Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. * An {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits * if implementation capacities are exceeded.</p>
*** 580,590 **** * <p>The datatype <code>xdt:yearMonthDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only year and month components. * This datatype resides in the namespace {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.</p> * * <p>Both values are set by computing their values from the specified milliseconds ! * and are availabe using the <code>get</code> methods of the created {@link Duration}. * The values conform to and are defined by:</p> * <ul> * <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> * <li><a href="http://www.w3.org/TR/xmlschema-2/#isoformats"> * W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</a> --- 579,589 ---- * <p>The datatype <code>xdt:yearMonthDuration</code> is a subtype of <code>xs:duration</code> * whose lexical representation contains only year and month components. * This datatype resides in the namespace {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.</p> * * <p>Both values are set by computing their values from the specified milliseconds ! * and are available using the <code>get</code> methods of the created {@link Duration}. * The values conform to and are defined by:</p> * <ul> * <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> * <li><a href="http://www.w3.org/TR/xmlschema-2/#isoformats"> * W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</a>