Commit 2c367c29 authored by mkorzen's avatar mkorzen

Adding JSR 280 API stubs.

The source has been extracted from the phoneME repository using the following commands:

svn export -r14283 https://phoneme.dev.java.net/svn/phoneme/components/jsr280/trunk/src/share/oi/org/w3c $OCAPAPI/ocap_api/src/org/w3c
svn export -r14283 https://phoneme.dev.java.net/svn/phoneme/components/jsr280/trunk/src/share/oi/org/xml $OCAPAPI/ocap_api/src/org/xml
svn export -r14283 https://phoneme.dev.java.net/svn/phoneme/components/jsr280/trunk/src/share/oi/javax/xml $OCAPAPI/ocap_api/src/javax/xml

where OCAPAPI variable points to a checked out version of the ocapapi SVN repository.

r14823 is the last working revision known to be compliant with the officially published API spec.
Check-in r14284 introduced some changes that break JSR 280.
parent b2d036fd
/*
* Portions Copyright 2000-2008 Sun Microsystems, Inc. All Rights
* Reserved. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package javax.xml;
/**
* Utility class to contain basic XML values as constants.
*
* @author <a href="http://jcp.org/">JAXP Java Community Process</a>
* @author <a href="http://java.sun.com/">JAXP Reference Implementation</a>
* @version 1.0.proposed
* @see <a href="http://www.w3.org/TR/REC-xml"> Extensible Markup Language (XML)
* 1.0 (Second Edition)</a>
* @see <a href="http://www.w3.org/TR/REC-xml-names"> Namespaces in XML</a>
* @see <a href="http://www.w3.org/XML/xml-names-19990114-errata"> Namespaces in
* XML Errata</a>
*/
public class XMLConstants {
/**
* Constructor to prevent instantiation.
*/
private XMLConstants() {
}
/**
* Prefix to use to represent the default XML Namespace.
*
* <p>
* Defined by the XML specification to be "".
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
* Namespaces in XML</a>
*/
public static final String DEFAULT_NS_PREFIX = "";
/**
* The official XML Namespace prefix.
*
* <p>
* Defined by the XML specification to be "<code>xml</code>".
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
* Namespaces in XML</a>
*/
public static final String XML_NS_PREFIX = "xml";
/**
* The official XML Namespace name URI.
*
* <p>
* Defined by the XML specification to be "<code>http://www.w3.org/XML/1998/namespace</code>".
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
* Namespaces in XML</a>
*/
public static final String XML_NS_URI = "http://www.w3.org/XML/1998/namespace";
/**
* The official XML attribute used for specifying XML Namespace
* declarations.
*
* <p>
* It is <strong>not</strong> valid to use as a prefix. Defined by the XML
* specification to be "<code>xmlns</code>".
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
* Namespaces in XML</a>
*/
public static final String XMLNS_ATTRIBUTE = "xmlns";
/**
* The official XML attribute used for specifying XML Namespace
* declarations, {@link #XMLNS_ATTRIBUTE "xmlns"}, Namespace name URI.
*
* <p>
* Defined by the XML specification to be "<code>http://www.w3.org/2000/xmlns/</code>".
* </p>
*
* @see <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">
* Namespaces in XML</a>
* @see <a href="http://www.w3.org/XML/xml-names-19990114-errata/">
* Namespaces in XML Errata</a>
*/
public static final String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/";
/**
* <p>Feature for secure processing.</p>
*
* <ul>
* <li>
* <code>true</code> instructs the implementation to process XML securely.
* This may set limits on XML constructs to avoid conditions such as denial of service attacks.
* </li>
* <li>
* <code>false</code> instructs the implementation to process XML according the letter of the XML specifications
* ignoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.
* </li>
* </ul>
*/
public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
}
/*
* Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package javax.xml.parsers;
import java.io.InputStream;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Defines the API to obtain DOM Document instances from an XML
* document. Using this class, an application programmer can obtain a
* {@link Document} from XML.<p>
*
* An instance of this class can be obtained from the
* {@link DocumentBuilderFactory#newDocumentBuilder()} method. Once
* an instance of this class is obtained, XML can be parsed from a
* variety of input sources. These input sources are InputStreams
* and SAX InputSources.<p>
*
* Note that this class reuses several classes from the SAX API. This
* does not require that the implementor of the underlying DOM
* implementation use a SAX parser to parse XML document into a
* <code>Document</code>. It merely requires that the implementation
* communicate with the application using these existing APIs.
*/
public abstract class DocumentBuilder
{
/** Protected constructor */
protected DocumentBuilder()
{
}
/**
* Parse the content of the given <code>InputStream</code> as an XML
* document and return a new DOM {@link Document} object.
* An <code>IllegalArgumentException</code> is thrown if the
* <code>InputStream</code> is null.
*
* @param is InputStream containing the content to be parsed.
* @return <code>Document</code> result of parsing the
* <code>InputStream</code>
* @exception IOException If any IO errors occur.
* @exception SAXException If any parse errors occur.
*/
public Document parse(InputStream is)
throws SAXException, IOException
{
if (is == null) {
throw new IllegalArgumentException("InputStream cannot be null");
}
InputSource in = new InputSource(is);
return parse(in);
}
/**
* Parse the content of the given input source as an XML document
* and return a new DOM {@link Document} object.
* An <code>IllegalArgumentException</code> is thrown if the
* <code>InputSource</code> is <code>null</code> null.
*
* @param is InputSource containing the content to be parsed.
* @exception IOException If any IO errors occur.
* @exception SAXException If any parse errors occur.
* @return A new DOM Document object.
*/
public abstract Document parse(InputSource is)
throws SAXException, IOException;
/**
* Indicates whether or not this parser is configured to
* understand namespaces.
*
* @return <code>true</code> if this parser is configured to understand
* namespaces; <code>false</code> otherwise.
*/
public abstract boolean isNamespaceAware();
/**
* Indicates whether or not this parser is configured to
* validate XML documents.
*
* @return <code>true</code> if this parser is configured to validate
* XML documents; <code>false</code> otherwise.
*/
public abstract boolean isValidating();
/**
* Specify the {@link EntityResolver} to be used to resolve
* entities present in the XML document to be parsed. Setting
* this to <code>null</code> will result in the underlying
* implementation using it's own default implementation and
* behavior.
*
* @param er The <code>EntityResolver</code> to be used to resolve entities
* present in the XML document to be parsed.
*/
public abstract void setEntityResolver(EntityResolver er);
/**
* Specify the {@link ErrorHandler} to be used by the parser.
* Setting this to <code>null</code> will result in the underlying
* implementation using it's own default implementation and
* behavior.
*
* @param eh The <code>ErrorHandler</code> to be used by the parser.
*/
public abstract void setErrorHandler(ErrorHandler eh);
/**
* Obtain a new instance of a DOM {@link Document} object
* to build a DOM tree with.
*
* @return A new instance of a DOM Document object.
*/
public abstract Document newDocument();
/**
* Obtain an instance of a {@link DOMImplementation} object.
*
* @return A new instance of a <code>DOMImplementation</code>.
*/
public abstract DOMImplementation getDOMImplementation();
}
This diff is collapsed.
/*
* Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package javax.xml.parsers;
/**
* Thrown when a problem with configuration with the Parser Factories
* exists. This error will typically be thrown when the class of a
* parser factory specified in the system properties cannot be found
* or instantiated.
*
* @since JAXP 1.0
*/
public class FactoryConfigurationError
extends Error
{
public FactoryConfigurationError(final String msg)
{
super(msg);
}
}
/*
* Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package javax.xml.parsers;
/**
* Indicates a serious configuration error.
*
* @since JAXP 1.0
*/
public class ParserConfigurationException
extends Exception
{
public ParserConfigurationException(final String msg)
{
super(msg);
}
}
/*
* Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package javax.xml.parsers;
import java.io.IOException;
import java.io.InputStream;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
/**
* Defines the API that represents a simple SAX parser.
*
* An instance of this class can be obtained from the
* {@link javax.xml.parsers.SAXParserFactory#newSAXParser()} method.
* Once an instance of this class is obtained, XML can be parsed from
* an InputStream<p>
*
* As the content is parsed by the underlying parser, methods of the
* given {@link org.xml.sax.helpers.DefaultHandler} are called.<p>
*
* An implementation of <code>SAXParser</code> is <em>NOT</em>
* guaranteed to behave as per the specification if it is used concurrently by
* two or more threads. It is recommended to have one instance of the
* <code>SAXParser</code> per thread or it is upto the application to
* make sure about the use of <code>SAXParser</code> from more than one
* thread.
*
* @since JAXP 1.0
*/
public abstract class SAXParser {
protected SAXParser()
{
}
/**
* Parse the content of the given {@link java.io.InputStream}
* instance as XML using the specified
* {@link org.xml.sax.helpers.DefaultHandler}.
*
* @param is InputStream containing the content to be parsed.
* @param dh The SAX DefaultHandler to use.
* @exception IOException If any IO errors occur.
* @exception IllegalArgumentException If the given InputStream is null.
* @exception SAXException If the underlying parser throws a
* SAXException while parsing.
*/
public abstract void parse(InputStream is, DefaultHandler dh)
throws SAXException, IOException;
/**
* Parse the content given {@link org.xml.sax.InputSource}
* as XML using the specified
* {@link org.xml.sax.helpers.DefaultHandler}.
*
* @param is The InputSource containing the content to be parsed.
* @param dh The SAX DefaultHandler to use.
* @exception IOException If any IO errors occur.
* @exception IllegalArgumentException If the InputSource is null.
* @exception SAXException If the underlying parser throws a
* SAXException while parsing.
* @see org.xml.sax.helpers.DefaultHandler
*/
public abstract void parse(InputSource is, DefaultHandler dh)
throws SAXException, IOException;
/**
* Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the
* implementation of this class.
*
* @return The XMLReader that is encapsulated by the
* implementation of this class.
*
* @throws SAXException If any SAX errors occur during processing.
*/
public abstract org.xml.sax.XMLReader getXMLReader()
throws SAXException;
/**
* Indicates whether or not this parser is configured to
* understand namespaces.
*
* @return <code>true</code> if this parser is configured to
* understand namespaces; <code>false</code> otherwise.
*/
public abstract boolean isNamespaceAware();
/**
* Indicates whether or not this parser is configured to validate
* XML documents.
*
* @return <code>true</code> if this parser is configured to validate XML
* documents; <code>false</code> otherwise.
*/
public abstract boolean isValidating();
}
/*
* Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package javax.xml.parsers;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXNotRecognizedException;
/**
* Defines a factory API that enables applications to configure and
* obtain a SAX based parser to parse XML documents.<p>
* An implementation of the <code>SAXParserFactory</code> class is
* <em>NOT</em> guaranteed to be thread safe. It is up to the user application
* to make sure about the use of the <code>SAXParserFactory</code> from
* more than one thread. Alternatively the application can have one instance
* of the <code>SAXParserFactory</code> per thread.
* An application can use the same instance of the factory to obtain one or
* more instances of the <code>SAXParser</code> provided the instance
* of the factory isn't being used in more than one thread at a time.
* <p>
*
* The static <code>newInstance</code> method returns a new concrete
* implementation of this class.
*
* @since JAXP 1.0
*/
public abstract class SAXParserFactory
{
private boolean namespaceAware = false;
private boolean validating = false;
protected SAXParserFactory()
{
}
/**
* Obtain a new instance of a <code>SAXParserFactory</code>. This
* static method creates a new factory instance
* This method uses the following ordered lookup procedure to determine
* the <code>SAXParserFactory</code> implementation class to
* load:
* <ul>
* <li>
* Use the <code>javax.xml.parsers.SAXParserFactory</code> system
* property.
* </li>
* <li>
* Platform default <code>SAXParserFactory</code> instance.
* </li>
* </ul>
*
* Once an application has obtained a reference to a
* <code>SAXParserFactory</code> it can use the factory to
* configure and obtain parser instances.
*
* @return A new instance of a SAXParserFactory.
*
* @exception FactoryConfigurationError if the implementation is
* not available or cannot be instantiated.
*/
public static SAXParserFactory newInstance()
throws FactoryConfigurationError
{
try {
String fname = System.getProperty("javax.xml.parsers.SAXParserFactory");
if(fname == null)
fname = "com.sun.ukit.xml.SAXParserFactoryImp";
return (SAXParserFactory) Class.forName(fname).newInstance();
} catch (java.lang.Throwable ex) {
throw new FactoryConfigurationError("");
}
}
/**
* Creates a new instance of a SAXParser using the currently
* configured factory parameters.
*
* @return A new instance of a SAXParser.
*
* @exception ParserConfigurationException if a parser cannot
* be created which satisfies the requested configuration.
*/
public abstract SAXParser newSAXParser()
throws ParserConfigurationException, SAXException;
/**
* Specifies that the parser produced by this code will
* provide support for XML namespaces. By default the value of this is set
* to <code>false</code>.
*
* @param awareness <code>true</code> if the parser produced by this code will
* provide support for XML namespaces; <code>false</code> otherwise.
*/
public void setNamespaceAware(boolean awareness)
{
namespaceAware = awareness;
}
/**
* Indicates whether or not the factory is configured to produce
* parsers which are namespace aware.
*
* @return <code>true</code> if the factory is configured to produce
* parsers which are namespace aware; <code>false</code> otherwise.
*/
public boolean isNamespaceAware()
{
return namespaceAware;
}
/**
* Specifies that the parser produced by this code will validate
* documents as they are parsed. By default the value of this is
* set to <code>false</code>.
*
* @param validating <code>true</code> if the parser produced by this code will