mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8077332: tidy warnings from javax/xml
Some HTML markup fix (jaxp part) Reviewed-by: joehw, lancea
This commit is contained in:
parent
7cbdcf978d
commit
b27f042010
30 changed files with 1381 additions and 1412 deletions
|
@ -37,7 +37,7 @@ import org.xml.sax.SAXNotSupportedException;
|
|||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Factory that creates {@link Schema} objects. Entry-point to
|
||||
* Factory that creates {@link Schema} objects. Entry-point to
|
||||
* the validation API.
|
||||
*
|
||||
* <p>
|
||||
|
@ -49,12 +49,12 @@ import org.xml.sax.SAXParseException;
|
|||
* it is the application's responsibility to ensure that at most
|
||||
* one thread is using a {@link SchemaFactory} object at any
|
||||
* given moment. Implementations are encouraged to mark methods
|
||||
* as <code>synchronized</code> to protect themselves from broken clients.
|
||||
* as {@code synchronized} to protect themselves from broken clients.
|
||||
*
|
||||
* <p>
|
||||
* {@link SchemaFactory} is not re-entrant. While one of the
|
||||
* <code>newSchema</code> methods is being invoked, applications
|
||||
* may not attempt to recursively invoke the <code>newSchema</code> method,
|
||||
* {@code newSchema} methods is being invoked, applications
|
||||
* may not attempt to recursively invoke the {@code newSchema} method,
|
||||
* even from the same thread.
|
||||
*
|
||||
* <h2><a name="schemaLanguage"></a>Schema Language</h2>
|
||||
|
@ -92,11 +92,11 @@ import org.xml.sax.SAXParseException;
|
|||
* </thead>
|
||||
* <tbody>
|
||||
* <tr>
|
||||
* <td>{@link javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI} ("<code>http://www.w3.org/2001/XMLSchema</code>")</td>
|
||||
* <td>{@link javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI} ("{@code http://www.w3.org/2001/XMLSchema}")</td>
|
||||
* <td><a href="http://www.w3.org/TR/xmlschema-1">W3C XML Schema 1.0</a></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@link javax.xml.XMLConstants#RELAXNG_NS_URI} ("<code>http://relaxng.org/ns/structure/1.0</code>")</td>
|
||||
* <td>{@link javax.xml.XMLConstants#RELAXNG_NS_URI} ("{@code http://relaxng.org/ns/structure/1.0}")</td>
|
||||
* <td><a href="http://www.relaxng.org/">RELAX NG 1.0</a></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
|
@ -112,24 +112,24 @@ public abstract class SchemaFactory {
|
|||
private static SecuritySupport ss = new SecuritySupport();
|
||||
|
||||
/**
|
||||
* <p>Constructor for derived classes.</p>
|
||||
* Constructor for derived classes.
|
||||
*
|
||||
* <p>The constructor does nothing.</p>
|
||||
* <p>The constructor does nothing.
|
||||
*
|
||||
* <p>Derived classes must create {@link SchemaFactory} objects that have
|
||||
* <code>null</code> {@link ErrorHandler} and
|
||||
* <code>null</code> {@link LSResourceResolver}.</p>
|
||||
* {@code null} {@link ErrorHandler} and
|
||||
* {@code null} {@link LSResourceResolver}.
|
||||
*/
|
||||
protected SchemaFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Lookup an implementation of the <code>SchemaFactory</code> that supports the specified
|
||||
* schema language and return it.</p>
|
||||
* Lookup an implementation of the {@code SchemaFactory} that supports the specified
|
||||
* schema language and return it.
|
||||
*
|
||||
* <p>To find a <code>SchemaFactory</code> object for a given schema language,
|
||||
* <p>To find a {@code SchemaFactory} object for a given schema language,
|
||||
* this method looks the following places in the following order
|
||||
* where "the class loader" refers to the context class loader:</p>
|
||||
* where "the class loader" refers to the context class loader:
|
||||
* <ol>
|
||||
* <li>
|
||||
* <p>
|
||||
|
@ -178,9 +178,9 @@ public abstract class SchemaFactory {
|
|||
* </li>
|
||||
* <li>
|
||||
* <p>
|
||||
* Platform default <code>SchemaFactory</code> is located
|
||||
* Platform default {@code SchemaFactory} is located
|
||||
* in a implementation specific way. There must be a platform default
|
||||
* <code>SchemaFactory</code> for W3C XML Schema.
|
||||
* {@code SchemaFactory} for W3C XML Schema.
|
||||
* </li>
|
||||
* </ol>
|
||||
*
|
||||
|
@ -201,12 +201,12 @@ public abstract class SchemaFactory {
|
|||
* <a href="#schemaLanguage">the list of available
|
||||
* schema languages</a> for the possible values.
|
||||
*
|
||||
* @return New instance of a <code>SchemaFactory</code>
|
||||
* @return New instance of a {@code SchemaFactory}
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If no implementation of the schema language is available.
|
||||
* @throws NullPointerException
|
||||
* If the <code>schemaLanguage</code> parameter is null.
|
||||
* If the {@code schemaLanguage} parameter is null.
|
||||
* @throws SchemaFactoryConfigurationError
|
||||
* If a configuration error is encountered.
|
||||
*
|
||||
|
@ -233,42 +233,42 @@ public abstract class SchemaFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Obtain a new instance of a <code>SchemaFactory</code> from class name. <code>SchemaFactory</code>
|
||||
* Obtain a new instance of a {@code SchemaFactory} from class name. {@code SchemaFactory}
|
||||
* is returned if specified factory class name supports the specified schema language.
|
||||
* This function is useful when there are multiple providers in the classpath.
|
||||
* It gives more control to the application as it can specify which provider
|
||||
* should be loaded.</p>
|
||||
* should be loaded.
|
||||
*
|
||||
* <h2>Tip for Trouble-shooting</h2>
|
||||
* <p>Setting the <code>jaxp.debug</code> system property will cause
|
||||
* <p>Setting the {@code jaxp.debug} system property will cause
|
||||
* this method to print a lot of debug messages
|
||||
* to <code>System.err</code> about what it is doing and where it is looking at.</p>
|
||||
* to {@code System.err} about what it is doing and where it is looking at.
|
||||
*
|
||||
* <p> If you have problems try:</p>
|
||||
* <p> If you have problems try:
|
||||
* <pre>
|
||||
* java -Djaxp.debug=1 YourProgram ....
|
||||
* </pre>
|
||||
*
|
||||
* @param schemaLanguage Specifies the schema language which the returned
|
||||
* <code>SchemaFactory</code> will understand. See
|
||||
* {@code SchemaFactory} will understand. See
|
||||
* <a href="#schemaLanguage">the list of available
|
||||
* schema languages</a> for the possible values.
|
||||
*
|
||||
* @param factoryClassName fully qualified factory class name that provides implementation of <code>javax.xml.validation.SchemaFactory</code>.
|
||||
* @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.validation.SchemaFactory}.
|
||||
*
|
||||
* @param classLoader <code>ClassLoader</code> used to load the factory class. If <code>null</code>
|
||||
* current <code>Thread</code>'s context classLoader is used to load the factory class.
|
||||
* @param classLoader {@code ClassLoader} used to load the factory class. If {@code null}
|
||||
* current {@code Thread}'s context classLoader is used to load the factory class.
|
||||
*
|
||||
* @return New instance of a <code>SchemaFactory</code>
|
||||
* @return New instance of a {@code SchemaFactory}
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if <code>factoryClassName</code> is <code>null</code>, or
|
||||
* if {@code factoryClassName} is {@code null}, or
|
||||
* the factory class cannot be loaded, instantiated or doesn't
|
||||
* support the schema language specified in <code>schemLanguage</code>
|
||||
* support the schema language specified in {@code schemLanguage}
|
||||
* parameter.
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* If the <code>schemaLanguage</code> parameter is null.
|
||||
* If the {@code schemaLanguage} parameter is null.
|
||||
*
|
||||
* @see #newInstance(String schemaLanguage)
|
||||
*
|
||||
|
@ -299,16 +299,16 @@ public abstract class SchemaFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Is specified schema supported by this <code>SchemaFactory</code>?</p>
|
||||
* Is specified schema supported by this {@code SchemaFactory}?
|
||||
*
|
||||
* @param schemaLanguage Specifies the schema language which the returned <code>SchemaFactory</code> will understand.
|
||||
* <code>schemaLanguage</code> must specify a <a href="#schemaLanguage">valid</a> schema language.
|
||||
* @param schemaLanguage Specifies the schema language which the returned {@code SchemaFactory} will understand.
|
||||
* {@code schemaLanguage} must specify a <a href="#schemaLanguage">valid</a> schema language.
|
||||
*
|
||||
* @return <code>true</code> if <code>SchemaFactory</code> supports <code>schemaLanguage</code>, else <code>false</code>.
|
||||
* @return {@code true} if {@code SchemaFactory} supports {@code schemaLanguage}, else {@code false}.
|
||||
*
|
||||
* @throws NullPointerException If <code>schemaLanguage</code> is <code>null</code>.
|
||||
* @throws IllegalArgumentException If <code>schemaLanguage.length() == 0</code>
|
||||
* or <code>schemaLanguage</code> does not specify a <a href="#schemaLanguage">valid</a> schema language.
|
||||
* @throws NullPointerException If {@code schemaLanguage} is {@code null}.
|
||||
* @throws IllegalArgumentException If {@code schemaLanguage.length() == 0}
|
||||
* or {@code schemaLanguage} does not specify a <a href="#schemaLanguage">valid</a> schema language.
|
||||
*/
|
||||
public abstract boolean isSchemaLanguageSupported(String schemaLanguage);
|
||||
|
||||
|
@ -320,7 +320,7 @@ public abstract class SchemaFactory {
|
|||
* temporarily be unable to return its value.
|
||||
*
|
||||
* <p>Implementors are free (and encouraged) to invent their own features,
|
||||
* using names built on their own URIs.</p>
|
||||
* using names built on their own URIs.
|
||||
*
|
||||
* @param name The feature name, which is a non-null fully-qualified URI.
|
||||
*
|
||||
|
@ -331,7 +331,7 @@ public abstract class SchemaFactory {
|
|||
* @throws SAXNotSupportedException When the
|
||||
* {@link SchemaFactory} recognizes the feature name but
|
||||
* cannot determine its value at this time.
|
||||
* @throws NullPointerException If <code>name</code> is <code>null</code>.
|
||||
* @throws NullPointerException If {@code name} is {@code null}.
|
||||
*
|
||||
* @see #setFeature(String, boolean)
|
||||
*/
|
||||
|
@ -345,38 +345,37 @@ public abstract class SchemaFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Set a feature for this <code>SchemaFactory</code>,
|
||||
* Set a feature for this {@code SchemaFactory},
|
||||
* {@link Schema}s created by this factory, and by extension,
|
||||
* {@link Validator}s and {@link ValidatorHandler}s created by
|
||||
* those {@link Schema}s.
|
||||
* </p>
|
||||
*
|
||||
* <p>Implementors and developers should pay particular attention
|
||||
* to how the special {@link Schema} object returned by {@link
|
||||
* #newSchema()} is processed. In some cases, for example, when the
|
||||
* <code>SchemaFactory</code> and the class actually loading the
|
||||
* {@code SchemaFactory} and the class actually loading the
|
||||
* schema come from different implementations, it may not be possible
|
||||
* for <code>SchemaFactory</code> features to be inherited automatically.
|
||||
* for {@code SchemaFactory} features to be inherited automatically.
|
||||
* Developers should
|
||||
* make sure that features, such as secure processing, are explicitly
|
||||
* set in both places.</p>
|
||||
* set in both places.
|
||||
*
|
||||
* <p>The feature name is any fully-qualified URI. It is
|
||||
* possible for a {@link SchemaFactory} to expose a feature value but
|
||||
* to be unable to change the current value.</p>
|
||||
* to be unable to change the current value.
|
||||
*
|
||||
* <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
|
||||
* When the feature is:</p>
|
||||
* When the feature is:
|
||||
* <ul>
|
||||
* <li>
|
||||
* <code>true</code>: the implementation will limit XML processing to conform to implementation limits.
|
||||
* {@code true}: the implementation will limit XML processing to conform to implementation limits.
|
||||
* Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
|
||||
* If XML processing is limited for security reasons, it will be reported via a call to the registered
|
||||
* {@link ErrorHandler#fatalError(SAXParseException exception)}.
|
||||
* See {@link #setErrorHandler(ErrorHandler errorHandler)}.
|
||||
* </li>
|
||||
* <li>
|
||||
* <code>false</code>: the implementation will processing XML according to the XML specifications without
|
||||
* {@code false}: the implementation will processing XML according to the XML specifications without
|
||||
* regard to possible implementation limits.
|
||||
* </li>
|
||||
* </ul>
|
||||
|
@ -389,7 +388,7 @@ public abstract class SchemaFactory {
|
|||
* @throws SAXNotSupportedException When the
|
||||
* {@link SchemaFactory} recognizes the feature name but
|
||||
* cannot set the requested value.
|
||||
* @throws NullPointerException If <code>name</code> is <code>null</code>.
|
||||
* @throws NullPointerException If {@code name} is {@code null}.
|
||||
*
|
||||
* @see #getFeature(String)
|
||||
*/
|
||||
|
@ -405,15 +404,15 @@ public abstract class SchemaFactory {
|
|||
/**
|
||||
* Set the value of a property.
|
||||
*
|
||||
* <p>The property name is any fully-qualified URI. It is
|
||||
* <p>The property name is any fully-qualified URI. It is
|
||||
* possible for a {@link SchemaFactory} to recognize a property name but
|
||||
* to be unable to change the current value.</p>
|
||||
* to be unable to change the current value.
|
||||
*
|
||||
* <p>
|
||||
* All implementations that implement JAXP 1.5 or newer are required to
|
||||
* support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
|
||||
* {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>
|
||||
* <p>Access to external DTDs in Schema files is restricted to the protocols
|
||||
|
@ -421,14 +420,14 @@ public abstract class SchemaFactory {
|
|||
* If access is denied during the creation of new Schema due to the restriction
|
||||
* of this property, {@link org.xml.sax.SAXException} will be thrown by the
|
||||
* {@link #newSchema(Source)} or {@link #newSchema(File)}
|
||||
* or {@link #newSchema(URL)} or or {@link #newSchema(Source[])} method.</p>
|
||||
* or {@link #newSchema(URL)} or {@link #newSchema(Source[])} method.
|
||||
*
|
||||
* <p>Access to external DTDs in xml source files is restricted to the protocols
|
||||
* specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
|
||||
* If access is denied during validation due to the restriction
|
||||
* of this property, {@link org.xml.sax.SAXException} will be thrown by the
|
||||
* {@link javax.xml.validation.Validator#validate(Source)} or
|
||||
* {@link javax.xml.validation.Validator#validate(Source, Result)} method.</p>
|
||||
* {@link javax.xml.validation.Validator#validate(Source, Result)} method.
|
||||
*
|
||||
* <p>Access to external reference set by the schemaLocation attribute is
|
||||
* restricted to the protocols specified by the
|
||||
|
@ -436,7 +435,7 @@ public abstract class SchemaFactory {
|
|||
* If access is denied during validation due to the restriction of this property,
|
||||
* {@link org.xml.sax.SAXException} will be thrown by the
|
||||
* {@link javax.xml.validation.Validator#validate(Source)} or
|
||||
* {@link javax.xml.validation.Validator#validate(Source, Result)} method.</p>
|
||||
* {@link javax.xml.validation.Validator#validate(Source, Result)} method.
|
||||
*
|
||||
* <p>Access to external reference set by the Import
|
||||
* and Include element is restricted to the protocols specified by the
|
||||
|
@ -444,7 +443,7 @@ public abstract class SchemaFactory {
|
|||
* If access is denied during the creation of new Schema due to the restriction
|
||||
* of this property, {@link org.xml.sax.SAXException} will be thrown by the
|
||||
* {@link #newSchema(Source)} or {@link #newSchema(File)}
|
||||
* or {@link #newSchema(URL)} or {@link #newSchema(Source[])} method.</p>
|
||||
* or {@link #newSchema(URL)} or {@link #newSchema(Source[])} method.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -456,7 +455,7 @@ public abstract class SchemaFactory {
|
|||
* @throws SAXNotSupportedException When the
|
||||
* {@link SchemaFactory} recognizes the property name but
|
||||
* cannot set the requested value.
|
||||
* @throws NullPointerException If <code>name</code> is <code>null</code>.
|
||||
* @throws NullPointerException If {@code name} is {@code null}.
|
||||
*/
|
||||
public void setProperty(String name, Object object)
|
||||
throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
|
@ -472,13 +471,13 @@ public abstract class SchemaFactory {
|
|||
*
|
||||
* <p>The property name is any fully-qualified URI. It is
|
||||
* possible for a {@link SchemaFactory} to recognize a property name but
|
||||
* temporarily be unable to return its value.</p>
|
||||
* temporarily be unable to return its value.
|
||||
*
|
||||
* <p>{@link SchemaFactory}s are not required to recognize any specific
|
||||
* property names.</p>
|
||||
* property names.
|
||||
*
|
||||
* <p>Implementors are free (and encouraged) to invent their own properties,
|
||||
* using names built on their own URIs.</p>
|
||||
* using names built on their own URIs.
|
||||
*
|
||||
* @param name The property name, which is a non-null fully-qualified URI.
|
||||
*
|
||||
|
@ -489,7 +488,7 @@ public abstract class SchemaFactory {
|
|||
* @throws SAXNotSupportedException When the
|
||||
* XMLReader recognizes the property name but
|
||||
* cannot determine its value at this time.
|
||||
* @throws NullPointerException If <code>name</code> is <code>null</code>.
|
||||
* @throws NullPointerException If {@code name} is {@code null}.
|
||||
*
|
||||
* @see #setProperty(String, Object)
|
||||
*/
|
||||
|
@ -504,7 +503,7 @@ public abstract class SchemaFactory {
|
|||
|
||||
/**
|
||||
* Sets the {@link ErrorHandler} to receive errors encountered
|
||||
* during the <code>newSchema</code> method invocation.
|
||||
* during the {@code newSchema} method invocation.
|
||||
*
|
||||
* <p>
|
||||
* Error handler can be used to customize the error handling process
|
||||
|
@ -521,7 +520,7 @@ public abstract class SchemaFactory {
|
|||
* <p>
|
||||
* If any {@link Throwable} (or instances of its derived classes)
|
||||
* is thrown from an {@link ErrorHandler},
|
||||
* the caller of the <code>newSchema</code> method will be thrown
|
||||
* the caller of the {@code newSchema} method will be thrown
|
||||
* the same {@link Throwable} object.
|
||||
*
|
||||
* <p>
|
||||
|
@ -557,7 +556,7 @@ public abstract class SchemaFactory {
|
|||
* {@link ValidatorHandler}s that are created from this {@link SchemaFactory}.
|
||||
*
|
||||
* @param errorHandler A new error handler to be set.
|
||||
* This parameter can be <code>null</code>.
|
||||
* This parameter can be {@code null}.
|
||||
*/
|
||||
public abstract void setErrorHandler(ErrorHandler errorHandler);
|
||||
|
||||
|
@ -583,7 +582,7 @@ public abstract class SchemaFactory {
|
|||
* when it needs to locate external resources while parsing schemas,
|
||||
* although exactly what constitutes "locating external resources" is
|
||||
* up to each schema language. For example, for W3C XML Schema,
|
||||
* this includes files <code><include></code>d or <code><import></code>ed,
|
||||
* this includes files {@code <include>}d or {@code <import>}ed,
|
||||
* and DTD referenced from schema files, etc.
|
||||
*
|
||||
* <p>
|
||||
|
@ -607,7 +606,7 @@ public abstract class SchemaFactory {
|
|||
* If a {@link LSResourceResolver} throws a {@link RuntimeException}
|
||||
* (or instances of its derived classes),
|
||||
* then the {@link SchemaFactory} will abort the parsing and
|
||||
* the caller of the <code>newSchema</code> method will receive
|
||||
* the caller of the {@code newSchema} method will receive
|
||||
* the same {@link RuntimeException}.
|
||||
*
|
||||
* <p>
|
||||
|
@ -635,48 +634,48 @@ public abstract class SchemaFactory {
|
|||
public abstract LSResourceResolver getResourceResolver();
|
||||
|
||||
/**
|
||||
* <p>Parses the specified source as a schema and returns it as a schema.</p>
|
||||
* Parses the specified source as a schema and returns it as a schema.
|
||||
*
|
||||
* <p>This is a convenience method for {@link #newSchema(Source[] schemas)}.</p>
|
||||
* <p>This is a convenience method for {@link #newSchema(Source[] schemas)}.
|
||||
*
|
||||
* @param schema Source that represents a schema.
|
||||
*
|
||||
* @return New <code>Schema</code> from parsing <code>schema</code>.
|
||||
* @return New {@code Schema} from parsing {@code schema}.
|
||||
*
|
||||
* @throws SAXException If a SAX error occurs during parsing.
|
||||
* @throws NullPointerException if <code>schema</code> is null.
|
||||
* @throws NullPointerException if {@code schema} is null.
|
||||
*/
|
||||
public Schema newSchema(Source schema) throws SAXException {
|
||||
return newSchema(new Source[]{schema});
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Parses the specified <code>File</code> as a schema and returns it as a <code>Schema</code>.</p>
|
||||
* Parses the specified {@code File} as a schema and returns it as a {@code Schema}.
|
||||
*
|
||||
* <p>This is a convenience method for {@link #newSchema(Source schema)}.</p>
|
||||
* <p>This is a convenience method for {@link #newSchema(Source schema)}.
|
||||
*
|
||||
* @param schema File that represents a schema.
|
||||
*
|
||||
* @return New <code>Schema</code> from parsing <code>schema</code>.
|
||||
* @return New {@code Schema} from parsing {@code schema}.
|
||||
*
|
||||
* @throws SAXException If a SAX error occurs during parsing.
|
||||
* @throws NullPointerException if <code>schema</code> is null.
|
||||
* @throws NullPointerException if {@code schema} is null.
|
||||
*/
|
||||
public Schema newSchema(File schema) throws SAXException {
|
||||
return newSchema(new StreamSource(schema));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Parses the specified <code>URL</code> as a schema and returns it as a <code>Schema</code>.</p>
|
||||
* Parses the specified {@code URL} as a schema and returns it as a {@code Schema}.
|
||||
*
|
||||
* <p>This is a convenience method for {@link #newSchema(Source schema)}.</p>
|
||||
* <p>This is a convenience method for {@link #newSchema(Source schema)}.
|
||||
*
|
||||
* @param schema <code>URL</code> that represents a schema.
|
||||
* @param schema {@code URL} that represents a schema.
|
||||
*
|
||||
* @return New <code>Schema</code> from parsing <code>schema</code>.
|
||||
* @return New {@code Schema} from parsing {@code schema}.
|
||||
*
|
||||
* @throws SAXException If a SAX error occurs during parsing.
|
||||
* @throws NullPointerException if <code>schema</code> is null.
|
||||
* @throws NullPointerException if {@code schema} is null.
|
||||
*/
|
||||
public Schema newSchema(URL schema) throws SAXException {
|
||||
return newSchema(new StreamSource(schema.toExternalForm()));
|
||||
|
@ -710,7 +709,7 @@ public abstract class SchemaFactory {
|
|||
* regard. While a processor should be consistent in its treatment of
|
||||
* JAXP schema sources and XML Schema imports, the behaviour between
|
||||
* JAXP-compliant parsers may vary; in particular, parsers may choose
|
||||
* to ignore all but the first <import> for a given namespace,
|
||||
* to ignore all but the first {@code <import>} for a given namespace,
|
||||
* regardless of information provided in schemaLocation.
|
||||
*
|
||||
* <p>
|
||||
|
@ -721,7 +720,7 @@ public abstract class SchemaFactory {
|
|||
* <h2>RELAX NG</h2>
|
||||
*
|
||||
* <p>For RELAX NG, this method must throw {@link UnsupportedOperationException}
|
||||
* if <code>schemas.length!=1</code>.
|
||||
* if {@code schemas.length!=1}.
|
||||
*
|
||||
*
|
||||
* @param schemas
|
||||
|
@ -748,7 +747,7 @@ public abstract class SchemaFactory {
|
|||
* When an {@link ErrorHandler} is set, errors are reported to
|
||||
* there first. See {@link #setErrorHandler(ErrorHandler)}.
|
||||
* @throws NullPointerException
|
||||
* If the <code>schemas</code> parameter itself is null or
|
||||
* If the {@code schemas} parameter itself is null or
|
||||
* any item in the array is null.
|
||||
* @throws IllegalArgumentException
|
||||
* If any item in the array is not recognized by this method.
|
||||
|
@ -765,7 +764,7 @@ public abstract class SchemaFactory {
|
|||
* is created.
|
||||
*
|
||||
* <p>Also, implementations are allowed to use implementation-specific
|
||||
* property/feature to alter the semantics of this method.</p>
|
||||
* property/feature to alter the semantics of this method.
|
||||
*
|
||||
* <p>Implementors and developers should pay particular attention
|
||||
* to how the features set on this {@link SchemaFactory} are
|
||||
|
@ -776,7 +775,7 @@ public abstract class SchemaFactory {
|
|||
* for {@link SchemaFactory} features to be inherited automatically.
|
||||
* Developers should
|
||||
* make sure that features, such as secure processing, are explicitly
|
||||
* set in both places.</p>
|
||||
* set in both places.
|
||||
*
|
||||
* <h2>W3C XML Schema 1.0</h2>
|
||||
* <p>
|
||||
|
|
|
@ -37,16 +37,15 @@ import org.xml.sax.SAXNotRecognizedException;
|
|||
import org.xml.sax.SAXNotSupportedException;
|
||||
|
||||
/**
|
||||
* <p>A processor that checks an XML document against {@link Schema}.</p>
|
||||
* A processor that checks an XML document against {@link Schema}.
|
||||
*
|
||||
* <p>
|
||||
* A validator object is not thread-safe and not reentrant.
|
||||
* In other words, it is the application's responsibility to make
|
||||
* sure that one {@link Validator} object is not used from
|
||||
* more than one thread at any given time, and while the <code>validate</code>
|
||||
* more than one thread at any given time, and while the {@code validate}
|
||||
* method is invoked, applications may not recursively call
|
||||
* the <code>validate</code> method.
|
||||
* <p>
|
||||
* the {@code validate} method.
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
|
||||
|
@ -57,27 +56,28 @@ public abstract class Validator {
|
|||
/**
|
||||
* Constructor for derived classes.
|
||||
*
|
||||
* <p>The constructor does nothing.</p>
|
||||
* <p>The constructor does nothing.
|
||||
*
|
||||
* <p>Derived classes must create {@link Validator} objects that have
|
||||
* <code>null</code> {@link ErrorHandler} and
|
||||
* <code>null</code> {@link LSResourceResolver}.
|
||||
* </p>
|
||||
* {@code null} {@link ErrorHandler} and
|
||||
* {@code null} {@link LSResourceResolver}.
|
||||
*/
|
||||
protected Validator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Reset this <code>Validator</code> to its original configuration.</p>
|
||||
* Reset this {@code Validator} to its original configuration.
|
||||
*
|
||||
* <p><code>Validator</code> is reset to the same state as when it was created with
|
||||
* <p>{@code Validator} is reset to the same state as when it was created with
|
||||
* {@link Schema#newValidator()}.
|
||||
* <code>reset()</code> is designed to allow the reuse of existing <code>Validator</code>s
|
||||
* thus saving resources associated with the creation of new <code>Validator</code>s.</p>
|
||||
* {@code reset()} is designed to allow the reuse of existing {@code Validator}s
|
||||
* thus saving resources associated with the creation of new {@code Validator}s.
|
||||
*
|
||||
* <p>The reset <code>Validator</code> is not guaranteed to have the same {@link LSResourceResolver} or {@link ErrorHandler}
|
||||
* <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal
|
||||
* <code>LSResourceResolver</code> and <code>ErrorHandler</code>.</p>
|
||||
* <p>The reset {@code Validator} is not guaranteed to have
|
||||
* the same {@link LSResourceResolver} or {@link ErrorHandler}
|
||||
* {@code Object}s, e.g. {@link Object#equals(Object obj)}.
|
||||
* It is guaranteed to have a functionally equal
|
||||
* {@code LSResourceResolver} and {@code ErrorHandler}.
|
||||
*/
|
||||
public abstract void reset();
|
||||
|
||||
|
@ -86,7 +86,7 @@ public abstract class Validator {
|
|||
*
|
||||
* <p>This is just a convenience method for
|
||||
* {@link #validate(Source source, Result result)}
|
||||
* with <code>result</code> of <code>null</code>.</p>
|
||||
* with {@code result} of {@code null}.
|
||||
*
|
||||
* @param source
|
||||
* XML to be validated. Must be an XML document or
|
||||
|
@ -97,7 +97,7 @@ public abstract class Validator {
|
|||
* or throw an IllegalArgumentException.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If the <code>Source</code>
|
||||
* If the {@code Source}
|
||||
* is an XML artifact that the implementation cannot
|
||||
* validate (for example, a processing instruction).
|
||||
*
|
||||
|
@ -113,8 +113,8 @@ public abstract class Validator {
|
|||
* {@link IOException}.
|
||||
*
|
||||
*
|
||||
* @throws NullPointerException If <code>source</code> is
|
||||
* <code>null</code>.
|
||||
* @throws NullPointerException If {@code source} is
|
||||
* {@code null}.
|
||||
*
|
||||
* @see #validate(Source source, Result result)
|
||||
*/
|
||||
|
@ -125,16 +125,16 @@ public abstract class Validator {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Validates the specified input and send the augmented validation
|
||||
* result to the specified output.</p>
|
||||
* Validates the specified input and send the augmented validation
|
||||
* result to the specified output.
|
||||
*
|
||||
* <p>This method places the following restrictions on the types of
|
||||
* the {@link Source}/{@link Result} accepted.</p>
|
||||
* the {@link Source}/{@link Result} accepted.
|
||||
*
|
||||
* <table border=1>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th colspan="5"><code>Source</code> / <code>Result</code> Accepted</th>
|
||||
* <th colspan="5">{@code Source} / {@code Result} Accepted</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th></th>
|
||||
|
@ -146,7 +146,7 @@ public abstract class Validator {
|
|||
* </thead>
|
||||
* <tbody align="center">
|
||||
* <tr>
|
||||
* <td><code>null</code></td>
|
||||
* <td>{@code null}</td>
|
||||
* <td>OK</td>
|
||||
* <td>OK</td>
|
||||
* <td>OK</td>
|
||||
|
@ -155,44 +155,44 @@ public abstract class Validator {
|
|||
* <tr>
|
||||
* <th>{@link javax.xml.transform.stream.StreamResult}</th>
|
||||
* <td>OK</td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th>{@link javax.xml.transform.sax.SAXResult}</th>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>OK</td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th>{@link javax.xml.transform.dom.DOMResult}</th>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>OK</td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th>{@link javax.xml.transform.stax.StAXResult}</th>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td><code>IllegalArgumentException</code></td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>{@code IllegalArgumentException}</td>
|
||||
* <td>OK</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>To validate one <code>Source</code> into another kind of
|
||||
* <code>Result</code>, use the identity transformer (see
|
||||
* {@link javax.xml.transform.TransformerFactory#newTransformer()}).</p>
|
||||
* <p>To validate one {@code Source} into another kind of
|
||||
* {@code Result}, use the identity transformer (see
|
||||
* {@link javax.xml.transform.TransformerFactory#newTransformer()}).
|
||||
*
|
||||
* <p>Errors found during the validation is sent to the specified
|
||||
* {@link ErrorHandler}.</p>
|
||||
* {@link ErrorHandler}.
|
||||
*
|
||||
* <p>If a document is valid, or if a document contains some errors
|
||||
* but none of them were fatal and the <code>ErrorHandler</code> didn't
|
||||
* throw any exception, then the method returns normally.</p>
|
||||
* but none of them were fatal and the {@code ErrorHandler} didn't
|
||||
* throw any exception, then the method returns normally.
|
||||
*
|
||||
* @param source
|
||||
* XML to be validated. Must be an XML document or
|
||||
|
@ -203,34 +203,34 @@ public abstract class Validator {
|
|||
* or throw an IllegalArgumentException.
|
||||
*
|
||||
* @param result
|
||||
* The <code>Result</code> object that receives (possibly augmented)
|
||||
* The {@code Result} object that receives (possibly augmented)
|
||||
* XML. This parameter can be null if the caller is not interested
|
||||
* in it.
|
||||
*
|
||||
* Note that when a <code>DOMResult</code> is used,
|
||||
* Note that when a {@code DOMResult} is used,
|
||||
* a validator might just pass the same DOM node from
|
||||
* <code>DOMSource</code> to <code>DOMResult</code>
|
||||
* (in which case <code>source.getNode()==result.getNode()</code>),
|
||||
* {@code DOMSource} to {@code DOMResult}
|
||||
* (in which case {@code source.getNode()==result.getNode()}),
|
||||
* it might copy the entire DOM tree, or it might alter the
|
||||
* node given by the source.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If the <code>Result</code> type doesn't match the
|
||||
* <code>Source</code> type of if the <code>Source</code>
|
||||
* If the {@code Result} type doesn't match the
|
||||
* {@code Source} type of if the {@code Source}
|
||||
* is an XML artifact that the implementation cannot
|
||||
* validate (for example, a processing instruction).
|
||||
* @throws SAXException
|
||||
* If the <code>ErrorHandler</code> throws a
|
||||
* <code>SAXException</code> or
|
||||
* if a fatal error is found and the <code>ErrorHandler</code> returns
|
||||
* If the {@code ErrorHandler} throws a
|
||||
* {@code SAXException} or
|
||||
* if a fatal error is found and the {@code ErrorHandler} returns
|
||||
* normally.
|
||||
* @throws IOException
|
||||
* If the validator is processing a
|
||||
* <code>SAXSource</code> and the
|
||||
* {@code SAXSource} and the
|
||||
* underlying {@link org.xml.sax.XMLReader} throws an
|
||||
* <code>IOException</code>.
|
||||
* {@code IOException}.
|
||||
* @throws NullPointerException
|
||||
* If the <code>source</code> parameter is <code>null</code>.
|
||||
* If the {@code source} parameter is {@code null}.
|
||||
*
|
||||
* @see #validate(Source source)
|
||||
*/
|
||||
|
@ -239,7 +239,7 @@ public abstract class Validator {
|
|||
|
||||
/**
|
||||
* Sets the {@link ErrorHandler} to receive errors encountered
|
||||
* during the <code>validate</code> method invocation.
|
||||
* during the {@code validate} method invocation.
|
||||
*
|
||||
* <p>
|
||||
* Error handler can be used to customize the error handling process
|
||||
|
@ -255,7 +255,7 @@ public abstract class Validator {
|
|||
*
|
||||
* <p>
|
||||
* If any {@link Throwable} is thrown from an {@link ErrorHandler},
|
||||
* the caller of the <code>validate</code> method will be thrown
|
||||
* the caller of the {@code validate} method will be thrown
|
||||
* the same {@link Throwable} object.
|
||||
*
|
||||
* <p>
|
||||
|
@ -329,7 +329,7 @@ public abstract class Validator {
|
|||
* If a {@link LSResourceResolver} throws a {@link RuntimeException}
|
||||
* (or instances of its derived classes),
|
||||
* then the {@link Validator} will abort the parsing and
|
||||
* the caller of the <code>validate</code> method will receive
|
||||
* the caller of the {@code validate} method will receive
|
||||
* the same {@link RuntimeException}.
|
||||
*
|
||||
* <p>
|
||||
|
@ -366,7 +366,7 @@ public abstract class Validator {
|
|||
* contexts, such as before, during, or after a validation.
|
||||
*
|
||||
* <p>Implementors are free (and encouraged) to invent their own features,
|
||||
* using names built on their own URIs.</p>
|
||||
* using names built on their own URIs.
|
||||
*
|
||||
* @param name The feature name, which is a non-null fully-qualified URI.
|
||||
*
|
||||
|
@ -398,14 +398,14 @@ public abstract class Validator {
|
|||
* <p>
|
||||
* Feature can be used to control the way a {@link Validator}
|
||||
* parses schemas, although {@link Validator}s are not required
|
||||
* to recognize any specific feature names.</p>
|
||||
* to recognize any specific feature names.
|
||||
*
|
||||
* <p>The feature name is any fully-qualified URI. It is
|
||||
* possible for a {@link Validator} to expose a feature value but
|
||||
* to be unable to change the current value.
|
||||
* Some feature values may be immutable or mutable only
|
||||
* in specific contexts, such as before, during, or after
|
||||
* a validation.</p>
|
||||
* a validation.
|
||||
*
|
||||
* @param name The feature name, which is a non-null fully-qualified URI.
|
||||
* @param value The requested value of the feature (true or false).
|
||||
|
@ -438,27 +438,27 @@ public abstract class Validator {
|
|||
* to be unable to change the current value.
|
||||
* Some property values may be immutable or mutable only
|
||||
* in specific contexts, such as before, during, or after
|
||||
* a validation.</p>
|
||||
* a validation.
|
||||
*
|
||||
* <p>
|
||||
* All implementations that implement JAXP 1.5 or newer are required to
|
||||
* support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} and
|
||||
* {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} properties.
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>
|
||||
* <p>Access to external DTDs in source or Schema file is restricted to
|
||||
* the protocols specified by the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD}
|
||||
* property. If access is denied during validation due to the restriction
|
||||
* of this property, {@link org.xml.sax.SAXException} will be thrown by the
|
||||
* {@link #validate(Source)} method.</p>
|
||||
* {@link #validate(Source)} method.
|
||||
*
|
||||
* <p>Access to external reference set by the schemaLocation attribute is
|
||||
* restricted to the protocols specified by the
|
||||
* {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA} property.
|
||||
* If access is denied during validation due to the restriction of this property,
|
||||
* {@link org.xml.sax.SAXException} will be thrown by the
|
||||
* {@link #validate(Source)} method.</p>
|
||||
* {@link #validate(Source)} method.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -490,13 +490,13 @@ public abstract class Validator {
|
|||
* possible for a {@link Validator} to recognize a property name but
|
||||
* temporarily be unable to return its value.
|
||||
* Some property values may be available only in specific
|
||||
* contexts, such as before, during, or after a validation.</p>
|
||||
* contexts, such as before, during, or after a validation.
|
||||
*
|
||||
* <p>{@link Validator}s are not required to recognize any specific
|
||||
* property names.</p>
|
||||
* property names.
|
||||
*
|
||||
* <p>Implementors are free (and encouraged) to invent their own properties,
|
||||
* using names built on their own URIs.</p>
|
||||
* using names built on their own URIs.
|
||||
*
|
||||
* @param name The property name, which is a non-null fully-qualified URI.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue