/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://jaxp.dev.java.net/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://jaxp.dev.java.net/CDDLv1.0.html
* If applicable add the following below this CDDL HEADER
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* $Id: DatatypeFactory.java,v 1.10 2006/05/19 01:08:42 jeffsuttor Exp $
* @(#)DatatypeFactory.java 1.17 06/07/13
*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
*/
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}.
* </li>
* </ol>
*
* @author <a href="mailto:Joseph.Fialli@Sun.COM">Joseph Fialli</a>
* @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
* @author <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a>
*
* @version $Revision: 1.10 $, $Date: 2006/05/19 01:08:42 $
* @since 1.5
*/
public abstract class DatatypeFactory {
/**
* <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>
*
* <p>Implementers should specify the name of an appropriate class
* to be instantiated if no other implementation resolution mechanism
* succeeds.</p>
*
* <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
* the fact that the value must be an xs:Duration, they simply exclude
* some Durations.
*/
private static final Pattern XDTSCHEMA_YMD =
=1= |