Validator.java revision 559
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This code is free software; you can redistribute it and/or modify it
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * under the terms of the GNU General Public License version 2 only, as
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * published by the Free Software Foundation. Oracle designates this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * particular file as subject to the "Classpath" exception as provided
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * by Oracle in the LICENSE file that accompanied this code.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This code is distributed in the hope that it will be useful, but WITHOUT
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * version 2 for more details (a copy is included in the LICENSE file that
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * accompanied this code).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You should have received a copy of the GNU General Public License version
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 2 along with this work; if not, write to the Free Software Foundation,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f96bd5c800e73e351b0b6e4bd7f00b578dad29bbAlan Wright * or visit www.oracle.com if you need additional information or have any
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * questions.
12b65585e720714b31036daaa2b30eb76014048eGordon Ross */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwpackage javax.xml.validation;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwimport java.io.IOException;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwimport javax.xml.transform.Result;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwimport javax.xml.transform.Source;
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desaiimport org.w3c.dom.ls.LSResourceResolver;
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desaiimport org.xml.sax.ErrorHandler;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwimport org.xml.sax.SAXException;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwimport org.xml.sax.SAXNotRecognizedException;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwimport org.xml.sax.SAXNotSupportedException;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/**
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <p>A processor that checks an XML document against {@link Schema}.</p>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * A validator object is not thread-safe and not reentrant.
3db3f65c6274eb042354801a308c8e9bc4994553amw * In other words, it is the application's responsibility to make
3db3f65c6274eb042354801a308c8e9bc4994553amw * sure that one {@link Validator} object is not used from
3db3f65c6274eb042354801a308c8e9bc4994553amw * more than one thread at any given time, and while the <code>validate</code>
3db3f65c6274eb042354801a308c8e9bc4994553amw * method is invoked, applications may not recursively call
3db3f65c6274eb042354801a308c8e9bc4994553amw * the <code>validate</code> method.
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
3db3f65c6274eb042354801a308c8e9bc4994553amw * @since 1.5
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amwpublic abstract class Validator {
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Constructor for derived classes.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>The constructor does nothing.</p>
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown *
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * <p>Derived classes must create {@link Validator} objects that have
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * <code>null</code> {@link ErrorHandler} and
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * <code>null</code> {@link LSResourceResolver}.
3db3f65c6274eb042354801a308c8e9bc4994553amw * </p>
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw protected Validator() {
3db3f65c6274eb042354801a308c8e9bc4994553amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>Reset this <code>Validator</code> to its original configuration.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p><code>Validator</code> is reset to the same state as when it was created with
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link Schema#newValidator()}.
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>reset()</code> is designed to allow the reuse of existing <code>Validator</code>s
3db3f65c6274eb042354801a308c8e9bc4994553amw * thus saving resources associated with the creation of new <code>Validator</code>s.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>The reset <code>Validator</code> is not guaranteed to have the same {@link LSResourceResolver} or {@link ErrorHandler}
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>LSResourceResolver</code> and <code>ErrorHandler</code>.</p>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public abstract void reset();
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Validates the specified input.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>This is just a convenience method for
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link #validate(Source source, Result result)}
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * with <code>result</code> of <code>null</code>.</p>
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross *
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * @param source
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * XML to be validated. Must be an XML document or
3db3f65c6274eb042354801a308c8e9bc4994553amw * XML element and must not be null. For backwards compatibility,
3db3f65c6274eb042354801a308c8e9bc4994553amw * the results of attempting to validate anything other than
3db3f65c6274eb042354801a308c8e9bc4994553amw * a document or element are implementation-dependent.
3db3f65c6274eb042354801a308c8e9bc4994553amw * Implementations must either recognize and process the input
3db3f65c6274eb042354801a308c8e9bc4994553amw * or throw an IllegalArgumentException.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws IllegalArgumentException
3db3f65c6274eb042354801a308c8e9bc4994553amw * If the <code>Source</code>
3db3f65c6274eb042354801a308c8e9bc4994553amw * is an XML artifact that the implementation cannot
3db3f65c6274eb042354801a308c8e9bc4994553amw * validate (for example, a processing instruction).
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXException
3db3f65c6274eb042354801a308c8e9bc4994553amw * If the {@link ErrorHandler} throws a {@link SAXException} or
3db3f65c6274eb042354801a308c8e9bc4994553amw * if a fatal error is found and the {@link ErrorHandler} returns
3db3f65c6274eb042354801a308c8e9bc4994553amw * normally.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws IOException
3db3f65c6274eb042354801a308c8e9bc4994553amw * If the validator is processing a
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link javax.xml.transform.sax.SAXSource} and the
3db3f65c6274eb042354801a308c8e9bc4994553amw * underlying {@link org.xml.sax.XMLReader} throws an
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link IOException}.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws NullPointerException If <code>source</code> is
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>null</code>.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @see #validate(Source source, Result result)
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public void validate(Source source)
3db3f65c6274eb042354801a308c8e9bc4994553amw throws SAXException, IOException {
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw validate(source, null);
3db3f65c6274eb042354801a308c8e9bc4994553amw }
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>Validates the specified input and send the augmented validation
3db3f65c6274eb042354801a308c8e9bc4994553amw * result to the specified output.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>This method places the following restrictions on the types of
3db3f65c6274eb042354801a308c8e9bc4994553amw * the {@link Source}/{@link Result} accepted.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <table border=1>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <thead>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th colspan="5"><code>Source</code> / <code>Result</code> Accepted</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th></th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th>{@link javax.xml.transform.stream.StreamSource}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th>{@link javax.xml.transform.sax.SAXSource}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th>{@link javax.xml.transform.dom.DOMSource}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th>{@link javax.xml.transform.stax.StAXSource}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </thead>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tbody align="center">
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>null</code></td>
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * <td>OK</td>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <td>OK</td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td>OK</td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td>OK</td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tr>
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * <th>{@link javax.xml.transform.stream.StreamResult}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td>OK</td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <th>{@link javax.xml.transform.sax.SAXResult}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
12b65585e720714b31036daaa2b30eb76014048eGordon Ross * <td>OK</td>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
12b65585e720714b31036daaa2b30eb76014048eGordon Ross * </tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tr>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <th>{@link javax.xml.transform.dom.DOMResult}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td>OK</td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </tr>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <tr>
12b65585e720714b31036daaa2b30eb76014048eGordon Ross * <th>{@link javax.xml.transform.stax.StAXResult}</th>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <td><code>IllegalArgumentException</code></td>
12b65585e720714b31036daaa2b30eb76014048eGordon Ross * <td>OK</td>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * </tr>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * </tbody>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </table>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>To validate one <code>Source</code> into another kind of
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * <code>Result</code>, use the identity transformer (see
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * {@link javax.xml.transform.TransformerFactory#newTransformer()}).</p>
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross *
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * <p>Errors found during the validation is sent to the specified
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link ErrorHandler}.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <p>If a document is valid, or if a document contains some errors
3db3f65c6274eb042354801a308c8e9bc4994553amw * but none of them were fatal and the <code>ErrorHandler</code> didn't
3db3f65c6274eb042354801a308c8e9bc4994553amw * throw any exception, then the method returns normally.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @param source
3db3f65c6274eb042354801a308c8e9bc4994553amw * XML to be validated. Must be an XML document or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * XML element and must not be null. For backwards compatibility,
3db3f65c6274eb042354801a308c8e9bc4994553amw * the results of attempting to validate anything other than
3db3f65c6274eb042354801a308c8e9bc4994553amw * a document or element are implementation-dependent.
3db3f65c6274eb042354801a308c8e9bc4994553amw * Implementations must either recognize and process the input
3db3f65c6274eb042354801a308c8e9bc4994553amw * or throw an IllegalArgumentException.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * @param result
3db3f65c6274eb042354801a308c8e9bc4994553amw * The <code>Result</code> object that receives (possibly augmented)
3db3f65c6274eb042354801a308c8e9bc4994553amw * XML. This parameter can be null if the caller is not interested
3db3f65c6274eb042354801a308c8e9bc4994553amw * in it.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * Note that when a <code>DOMResult</code> is used,
3db3f65c6274eb042354801a308c8e9bc4994553amw * a validator might just pass the same DOM node from
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <code>DOMSource</code> to <code>DOMResult</code>
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * (in which case <code>source.getNode()==result.getNode()</code>),
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * it might copy the entire DOM tree, or it might alter the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * node given by the source.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross *
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * @throws IllegalArgumentException
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * If the <code>Result</code> type doesn't match the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * <code>Source</code> type of if the <code>Source</code>
3db3f65c6274eb042354801a308c8e9bc4994553amw * is an XML artifact that the implementation cannot
3db3f65c6274eb042354801a308c8e9bc4994553amw * validate (for example, a processing instruction).
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXException
3db3f65c6274eb042354801a308c8e9bc4994553amw * If the <code>ErrorHandler</code> throws a
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>SAXException</code> or
3db3f65c6274eb042354801a308c8e9bc4994553amw * if a fatal error is found and the <code>ErrorHandler</code> returns
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * normally.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws IOException
3db3f65c6274eb042354801a308c8e9bc4994553amw * If the validator is processing a
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>SAXSource</code> and the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * underlying {@link org.xml.sax.XMLReader} throws an
3db3f65c6274eb042354801a308c8e9bc4994553amw * <code>IOException</code>.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws NullPointerException
3db3f65c6274eb042354801a308c8e9bc4994553amw * If the <code>source</code> parameter is <code>null</code>.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @see #validate(Source source)
3db3f65c6274eb042354801a308c8e9bc4994553amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw public abstract void validate(Source source, Result result)
3db3f65c6274eb042354801a308c8e9bc4994553amw throws SAXException, IOException;
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Sets the {@link ErrorHandler} to receive errors encountered
3db3f65c6274eb042354801a308c8e9bc4994553amw * during the <code>validate</code> method invocation.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * Error handler can be used to customize the error handling process
3db3f65c6274eb042354801a308c8e9bc4994553amw * during a validation. When an {@link ErrorHandler} is set,
3db3f65c6274eb042354801a308c8e9bc4994553amw * errors found during the validation will be first sent
3db3f65c6274eb042354801a308c8e9bc4994553amw * to the {@link ErrorHandler}.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * The error handler can abort further validation immediately
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * by throwing {@link SAXException} from the handler. Or for example
3db3f65c6274eb042354801a308c8e9bc4994553amw * it can print an error to the screen and try to continue the
3db3f65c6274eb042354801a308c8e9bc4994553amw * validation by returning normally from the {@link ErrorHandler}
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * If any {@link Throwable} is thrown from an {@link ErrorHandler},
3db3f65c6274eb042354801a308c8e9bc4994553amw * the caller of the <code>validate</code> method will be thrown
3db3f65c6274eb042354801a308c8e9bc4994553amw * the same {@link Throwable} object.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link Validator} is not allowed to
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * throw {@link SAXException} without first reporting it to
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * {@link ErrorHandler}.
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego *
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * <p>
f96bd5c800e73e351b0b6e4bd7f00b578dad29bbAlan Wright * When the {@link ErrorHandler} is null, the implementation will
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * behave as if the following {@link ErrorHandler} is set:
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * <pre>
3db3f65c6274eb042354801a308c8e9bc4994553amw * class DraconianErrorHandler implements {@link ErrorHandler} {
3db3f65c6274eb042354801a308c8e9bc4994553amw * public void fatalError( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * throw e;
3db3f65c6274eb042354801a308c8e9bc4994553amw * }
3db3f65c6274eb042354801a308c8e9bc4994553amw * public void error( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} {
3db3f65c6274eb042354801a308c8e9bc4994553amw * throw e;
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * }
3db3f65c6274eb042354801a308c8e9bc4994553amw * public void warning( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} {
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * // noop
3db3f65c6274eb042354801a308c8e9bc4994553amw * }
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * }
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * </pre>
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego *
f96bd5c800e73e351b0b6e4bd7f00b578dad29bbAlan Wright * <p>
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * When a new {@link Validator} object is created, initially
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * this field is set to null.
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego *
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * @param errorHandler
3db3f65c6274eb042354801a308c8e9bc4994553amw * A new error handler to be set. This parameter can be null.
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public abstract void setErrorHandler(ErrorHandler errorHandler);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Gets the current {@link ErrorHandler} set to this {@link Validator}.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @return
3db3f65c6274eb042354801a308c8e9bc4994553amw * This method returns the object that was last set through
3db3f65c6274eb042354801a308c8e9bc4994553amw * the {@link #setErrorHandler(ErrorHandler)} method, or null
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * if that method has never been called since this {@link Validator}
3db3f65c6274eb042354801a308c8e9bc4994553amw * has created.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @see #setErrorHandler(ErrorHandler)
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public abstract ErrorHandler getErrorHandler();
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Sets the {@link LSResourceResolver} to customize
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * resource resolution while in a validation episode.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link Validator} uses a {@link LSResourceResolver}
3db3f65c6274eb042354801a308c8e9bc4994553amw * when it needs to locate external resources while a validation,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * although exactly what constitutes "locating external resources" is
3db3f65c6274eb042354801a308c8e9bc4994553amw * up to each schema language.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * When the {@link LSResourceResolver} is null, the implementation will
12b65585e720714b31036daaa2b30eb76014048eGordon Ross * behave as if the following {@link LSResourceResolver} is set:
3db3f65c6274eb042354801a308c8e9bc4994553amw * <pre>
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * class DumbLSResourceResolver implements {@link LSResourceResolver} {
3db3f65c6274eb042354801a308c8e9bc4994553amw * public {@link org.w3c.dom.ls.LSInput} resolveResource(
3db3f65c6274eb042354801a308c8e9bc4994553amw * String publicId, String systemId, String baseURI) {
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * return null; // always return null
3db3f65c6274eb042354801a308c8e9bc4994553amw * }
3db3f65c6274eb042354801a308c8e9bc4994553amw * }
3db3f65c6274eb042354801a308c8e9bc4994553amw * </pre>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
12b65585e720714b31036daaa2b30eb76014048eGordon Ross * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * If a {@link LSResourceResolver} throws a {@link RuntimeException}
3db3f65c6274eb042354801a308c8e9bc4994553amw * (or instances of its derived classes),
3db3f65c6274eb042354801a308c8e9bc4994553amw * then the {@link Validator} will abort the parsing and
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * the caller of the <code>validate</code> method will receive
3db3f65c6274eb042354801a308c8e9bc4994553amw * the same {@link RuntimeException}.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When a new {@link Validator} object is created, initially
3db3f65c6274eb042354801a308c8e9bc4994553amw * this field is set to null.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @param resourceResolver
3db3f65c6274eb042354801a308c8e9bc4994553amw * A new resource resolver to be set. This parameter can be null.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public abstract void setResourceResolver(LSResourceResolver resourceResolver);
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Gets the current {@link LSResourceResolver} set to this {@link Validator}.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @return
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai * This method returns the object that was last set through
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the {@link #setResourceResolver(LSResourceResolver)} method, or null
3db3f65c6274eb042354801a308c8e9bc4994553amw * if that method has never been called since this {@link Validator}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * has created.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @see #setErrorHandler(ErrorHandler)
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public abstract LSResourceResolver getResourceResolver();
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Look up the value of a feature flag.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>The feature name is any fully-qualified URI. It is
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai * possible for a {@link Validator} to recognize a feature name but
3db3f65c6274eb042354801a308c8e9bc4994553amw * temporarily be unable to return its value.
3db3f65c6274eb042354801a308c8e9bc4994553amw * Some feature values may be available only in specific
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * contexts, such as before, during, or after a validation.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>Implementors are free (and encouraged) to invent their own features,
3db3f65c6274eb042354801a308c8e9bc4994553amw * using names built on their own URIs.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * @param name The feature name, which is a non-null fully-qualified URI.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @return The current value of the feature (true or false).
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXNotRecognizedException If the feature
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * value can't be assigned or retrieved.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXNotSupportedException When the
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link Validator} recognizes the feature name but
3db3f65c6274eb042354801a308c8e9bc4994553amw * cannot determine its value at this time.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws NullPointerException
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When the name parameter is null.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * @see #setFeature(String, boolean)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public boolean getFeature(String name)
3db3f65c6274eb042354801a308c8e9bc4994553amw throws SAXNotRecognizedException, SAXNotSupportedException {
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw if (name == null) {
3db3f65c6274eb042354801a308c8e9bc4994553amw throw new NullPointerException("the name parameter is null");
3db3f65c6274eb042354801a308c8e9bc4994553amw }
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw throw new SAXNotRecognizedException(name);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Set the value of a feature flag.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * Feature can be used to control the way a {@link Validator}
3db3f65c6274eb042354801a308c8e9bc4994553amw * parses schemas, although {@link Validator}s are not required
3db3f65c6274eb042354801a308c8e9bc4994553amw * to recognize any specific feature names.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * <p>The feature name is any fully-qualified URI. It is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * possible for a {@link Validator} to expose a feature value but
3db3f65c6274eb042354801a308c8e9bc4994553amw * to be unable to change the current value.
3db3f65c6274eb042354801a308c8e9bc4994553amw * Some feature values may be immutable or mutable only
3db3f65c6274eb042354801a308c8e9bc4994553amw * in specific contexts, such as before, during, or after
3db3f65c6274eb042354801a308c8e9bc4994553amw * a validation.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @param name The feature name, which is a non-null fully-qualified URI.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @param value The requested value of the feature (true or false).
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXNotRecognizedException If the feature
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * value can't be assigned or retrieved.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * @throws SAXNotSupportedException When the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * {@link Validator} recognizes the feature name but
3db3f65c6274eb042354801a308c8e9bc4994553amw * cannot set the requested value.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws NullPointerException
3db3f65c6274eb042354801a308c8e9bc4994553amw * When the name parameter is null.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @see #getFeature(String)
3db3f65c6274eb042354801a308c8e9bc4994553amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public void setFeature(String name, boolean value)
3db3f65c6274eb042354801a308c8e9bc4994553amw throws SAXNotRecognizedException, SAXNotSupportedException {
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw if (name == null) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw throw new NullPointerException("the name parameter is null");
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
3db3f65c6274eb042354801a308c8e9bc4994553amw throw new SAXNotRecognizedException(name);
3db3f65c6274eb042354801a308c8e9bc4994553amw }
3db3f65c6274eb042354801a308c8e9bc4994553amw
3db3f65c6274eb042354801a308c8e9bc4994553amw /**
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Set the value of a property.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>The property name is any fully-qualified URI. It is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * possible for a {@link Validator} to recognize a property name but
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to be unable to change the current value.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Some property values may be immutable or mutable only
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in specific contexts, such as before, during, or after
3db3f65c6274eb042354801a308c8e9bc4994553amw * a validation.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * All implementations that implement JAXP 1.5 or newer are required to
3db3f65c6274eb042354801a308c8e9bc4994553amw * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * </p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <ul>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <li>
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>Access to external DTDs in source or Schema file is restricted to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the protocols specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD}
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * property. If access is denied during validation due to the restriction
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * of this property, {@link org.xml.sax.SAXException} will be thrown by the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * {@link #validate(Source)} method.</p>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>Access to external reference set by the schemaLocation attribute is
3db3f65c6274eb042354801a308c8e9bc4994553amw * restricted to the protocols specified by the
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If access is denied during validation due to the restriction of this property,
3db3f65c6274eb042354801a308c8e9bc4994553amw * {@link org.xml.sax.SAXException} will be thrown by the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * {@link #validate(Source)} method.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </li>
3db3f65c6274eb042354801a308c8e9bc4994553amw * </ul>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * @param name The property name, which is a non-null fully-qualified URI.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @param object The requested value for the property.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * @throws SAXNotRecognizedException If the property
3db3f65c6274eb042354801a308c8e9bc4994553amw * value can't be assigned or retrieved.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXNotSupportedException When the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * {@link Validator} recognizes the property name but
3db3f65c6274eb042354801a308c8e9bc4994553amw * cannot set the requested value.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws NullPointerException
3db3f65c6274eb042354801a308c8e9bc4994553amw * When the name parameter is null.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public void setProperty(String name, Object object)
3db3f65c6274eb042354801a308c8e9bc4994553amw throws SAXNotRecognizedException, SAXNotSupportedException {
3db3f65c6274eb042354801a308c8e9bc4994553amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (name == null) {
3db3f65c6274eb042354801a308c8e9bc4994553amw throw new NullPointerException("the name parameter is null");
3db3f65c6274eb042354801a308c8e9bc4994553amw }
3db3f65c6274eb042354801a308c8e9bc4994553amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw throw new SAXNotRecognizedException(name);
3db3f65c6274eb042354801a308c8e9bc4994553amw }
3db3f65c6274eb042354801a308c8e9bc4994553amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /**
3db3f65c6274eb042354801a308c8e9bc4994553amw * Look up the value of a property.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>The property name is any fully-qualified URI. It is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * possible for a {@link Validator} to recognize a property name but
3db3f65c6274eb042354801a308c8e9bc4994553amw * temporarily be unable to return its value.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Some property values may be available only in specific
3db3f65c6274eb042354801a308c8e9bc4994553amw * contexts, such as before, during, or after a validation.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>{@link Validator}s are not required to recognize any specific
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * property names.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * <p>Implementors are free (and encouraged) to invent their own properties,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * using names built on their own URIs.</p>
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @param name The property name, which is a non-null fully-qualified URI.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @return The current value of the property.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws SAXNotRecognizedException If the property
3db3f65c6274eb042354801a308c8e9bc4994553amw * value can't be assigned or retrieved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * @throws SAXNotSupportedException When the
3db3f65c6274eb042354801a308c8e9bc4994553amw * XMLReader recognizes the property name but
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * cannot determine its value at this time.
3db3f65c6274eb042354801a308c8e9bc4994553amw * @throws NullPointerException
3db3f65c6274eb042354801a308c8e9bc4994553amw * When the name parameter is null.
3db3f65c6274eb042354801a308c8e9bc4994553amw *
3db3f65c6274eb042354801a308c8e9bc4994553amw * @see #setProperty(String, Object)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
3db3f65c6274eb042354801a308c8e9bc4994553amw public Object getProperty(String name)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw throws SAXNotRecognizedException, SAXNotSupportedException {
3db3f65c6274eb042354801a308c8e9bc4994553amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (name == null) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw throw new NullPointerException("the name parameter is null");
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
3db3f65c6274eb042354801a308c8e9bc4994553amw throw new SAXNotRecognizedException(name);
3db3f65c6274eb042354801a308c8e9bc4994553amw }
3db3f65c6274eb042354801a308c8e9bc4994553amw}
3db3f65c6274eb042354801a308c8e9bc4994553amw