/*
* 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: ValidatorHandler.java,v 1.5 2005/11/03 19:34:24 jeffsuttor Exp $
* @(#)ValidatorHandler.java 1.17 05/12/07
*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
*/
package javax.xml.validation;
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.ContentHandler;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/**
* Streaming validator that works on SAX stream.
*
* <p>
* A {@link ValidatorHandler} object is not thread-safe and not reentrant.
* In other words, it is the application's responsibility to make
* sure that one {@link ValidatorHandler} object is not used from
* more than one thread at any given time.
*
* <p>
* {@link ValidatorHandler} checks if the SAX events follow
* the set of constraints described in the associated {@link Schema},
* and additionally it may modify the SAX events (for example
* by adding default values, etc.)
*
* <p>
* {@link ValidatorHandler} extends from {@link ContentHandler},
* but it refines the underlying {@link ContentHandler} in
* the following way:
* <ol>
* <li>startElement/endElement events must receive non-null String
* for <code>uri</code>, <code>localName</code>, and <code>qname</code>,
* even though SAX allows some of them to be null.
* Similarly, the user-specified {@link ContentHandler} will receive non-null
* Strings for all three parameters.
*
* <li>Applications must ensure that {@link ValidatorHandler}'s
* {@link ContentHandler#startPrefixMapping(String,String)} and
* {@link ContentHandler#endPrefixMapping(String)} are invoked
* properly. Similarly, the user-specified {@link ContentHandler}
* will receive startPrefixMapping/endPrefixMapping events.
* If the {@link ValidatorHandler} introduces additional namespace
* bindings, the user-specified {@link ContentHandler} will receive
* additional startPrefixMapping/endPrefixMapping events.
*
* <li>{@link org.xml.sax.Attributes} for the
* {@link ContentHandler#startElement(String,String,String,Attributes)} method
* may or may not include xmlns* attributes.
* </ol>
*
* <p>
* A {@link ValidatorHandler} is automatically reset every time
* the startDocument method is invoked.
*
* <h2>Recognized Properties and Features</h2>
* <p>
* This spec defines the following feature that must be recognized
* by all {@link ValidatorHandler} implementations.
*
* <h3><code>http://xml.org/sax/features/namespace-prefixes</code></h3>
* <p>
* This feature controls how a {@link ValidatorHandler} introduces
* namespace bindings that were not present in the original SAX event
* stream.
* When this feature is set to true, it must make
* sure that the user's {@link ContentHandler} will see
* the corresponding <code>xmlns*</code> attribute in
* the {@link org.xml.sax.Attributes} object of the
* {@link ContentHandler#startElement(String,String,String,Attributes)}
* callback. Otherwise, <code>xmlns*</code> attributes must not be
* added to {@link org.xml.sax.Attributes} that's passed to the
* user-specified {@link ContentHandler}.
* <p>
* (Note that regardless of this switch, namespace bindings are
* always notified to applications through
=1= |