286N/Aor visit www.oracle.com if you need additional information or have any
286N/A This package provides an API for validation of XML documents. <em>Validation</em> is the process of verifying
286N/A that an XML document is an instance of a specified XML <em>schema</em>. An XML schema defines the
286N/A content model (also called a <em>grammar</em> or <em>vocabulary</em>) that its instance documents
286N/A There are a number of popular technologies available for creating an XML schema. Some of the most
286N/A <li><strong><a href="http://www.w3.org/XML/Schema">W3C XML Schema (WXS)</a></strong> - an object-oriented XML schema
286N/A language. WXS also provides a type system for constraining the character data of an XML document.
286N/A WXS is maintained by the <a href="http://www.w3.org">World Wide Web Consortium (W3C)</a> and is a W3C
286N/A user-friendly XML schema language. RNG schemas may also use types to constrain XML character data.
286N/A RNG is maintained by the <a href="http://www.oasis-open.org">Organization for the Advancement of
286N/A <a href="http://www.iso.org">ISO (International Organization for Standardization)</a> standard.</li>
286N/A <li><strong><a href="http://www.schematron.com/">Schematron</a></strong> - a rules-based XML schema
286N/A language. Whereas DTD, WXS, and RNG are designed to express the structure of a content model,
286N/A Schematron is designed to enforce individual rules that are difficult or impossible to express
286N/A either a {@link javax.xml.parsers.SAXParser} or {@link javax.xml.parsers.DocumentBuilder} instance.
286N/A The JAXP validation API decouples the validation of an instance document from the parsing of an
286N/A popular JAXP parser implementations, Crimson and Xerces, only support a subset of the available
286N/A XML schema languages. The Validation API provides a standard mechanism through which applications
286N/A <li><strong>Easy runtime coupling of an XML instance and schema.</strong> Specifying the location
286N/A of a schema to use for validation with JAXP parsers can be confusing. The Validation API makes this
286N/A <a name="example-1"><strong>Usage example</strong>.</a> The following example demonstrates validating
286N/A an XML document with the Validation API (for readability, some exception handling is not shown):
286N/A DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
286N/A Source schemaFile = new StreamSource(new File("mySchema.xsd"));
286N/A Schema schema = factory.newSchema(schemaFile);
286N/A Validator validator = schema.newValidator();
286N/A validator.validate(new DOMSource(document));
286N/A The JAXP parsing API has been integrated with the Validation API. Applications may create a {@link javax.xml.validation.Schema} with the validation API
286N/A and associate it with a {@link javax.xml.parsers.DocumentBuilderFactory} or a {@link javax.xml.parsers.SAXParserFactory} instance
286N/A by using the {@link javax.xml.parsers.DocumentBuilderFactory#setSchema(Schema)} and {@link javax.xml.parsers.SAXParserFactory#setSchema(Schema)}
286N/A methods. <strong>You should not</strong> both set a schema and call <code>setValidating(true)</code> on a parser factory. The former technique
286N/A will cause parsers to use the new validation API; the latter will cause parsers to use their own internal validation