da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinCopyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinDO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis code is free software; you can redistribute it and/or modify it
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinunder the terms of the GNU General Public License version 2 only, as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinpublished by the Free Software Foundation. Oracle designates this
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinparticular file as subject to the "Classpath" exception as provided
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinby Oracle in the LICENSE file that accompanied this code.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis code is distributed in the hope that it will be useful, but WITHOUT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinversion 2 for more details (a copy is included in the LICENSE file that
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinaccompanied this code).
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinYou should have received a copy of the GNU General Public License version
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin2 along with this work; if not, write to the Free Software Foundation,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinPlease contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinor visit www.oracle.com if you need additional information or have any
content="$Id: package.html,v 1.2 2005/06/10 03:50:43 jeffsuttor Exp $" />
This package provides an API for validation of XML documents. <em>Validation</em> is the process of verifying
<li><strong><a href="http://www.w3.org/XML/Schema">W3C XML Schema (WXS)</a></strong> - an object-oriented XML schema
WXS is maintained by the <a href="http://www.w3.org">World Wide Web Consortium (W3C)</a> and is a W3C
<a href="http://www.iso.org">ISO (International Organization for Standardization)</a> standard.</li>
<a name="example-1"><strong>Usage example</strong>.</a> The following example demonstrates validating
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Source schemaFile = new StreamSource(new File("mySchema.xsd"));
Schema schema = factory.newSchema(schemaFile);
Validator validator = schema.newValidator();
validator.validate(new DOMSource(document));
The JAXP parsing API has been integrated with the Validation API. Applications may create a {@link javax.xml.validation.Schema} with the validation API
and associate it with a {@link javax.xml.parsers.DocumentBuilderFactory} or a {@link javax.xml.parsers.SAXParserFactory} instance
by using the {@link javax.xml.parsers.DocumentBuilderFactory#setSchema(Schema)} and {@link javax.xml.parsers.SAXParserFactory#setSchema(Schema)}
methods. <strong>You should not</strong> both set a schema and call <code>setValidating(true)</code> on a parser factory. The former technique
will cause parsers to use the new validation API; the latter will cause parsers to use their own internal validation