org.springframework.xml.validation
Class XmlValidatorFactory

java.lang.Object
  extended by org.springframework.xml.validation.XmlValidatorFactory

public abstract class XmlValidatorFactory
extends java.lang.Object

Factory for XmlValidator objects, being aware of JAXP 1.3 Validators, and JAXP 1.0 parsing capababilities. Mainly for internal use within the framework.

The goal of this class is to avoid runtime dependencies on JAXP 1.3 by using the best validation implementation that is available. Prefers JAXP 1.3 XmlValidator implementations to a custom, SAX-based implementation.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
XmlValidator

Field Summary
static java.lang.String SCHEMA_RELAX_NG
          Constant that defines a RELAX NG Schema.
static java.lang.String SCHEMA_W3C_XML
          Constant that defines a W3C XML Schema.
 
Constructor Summary
XmlValidatorFactory()
           
 
Method Summary
static XmlValidator createValidator(org.springframework.core.io.Resource[] schemaResources, java.lang.String schemaLanguage)
          Create a XmlValidator with the given schema resources and schema language type.
static XmlValidator createValidator(org.springframework.core.io.Resource schemaResource, java.lang.String schemaLanguage)
          Create a XmlValidator with the given schema resource and schema language type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_W3C_XML

public static final java.lang.String SCHEMA_W3C_XML
Constant that defines a W3C XML Schema.

See Also:
Constant Field Values

SCHEMA_RELAX_NG

public static final java.lang.String SCHEMA_RELAX_NG
Constant that defines a RELAX NG Schema.

See Also:
Constant Field Values
Constructor Detail

XmlValidatorFactory

public XmlValidatorFactory()
Method Detail

createValidator

public static XmlValidator createValidator(org.springframework.core.io.Resource schemaResource,
                                           java.lang.String schemaLanguage)
                                    throws java.io.IOException
Create a XmlValidator with the given schema resource and schema language type. The schema language must be one of the SCHEMA_XXX constants.

Parameters:
schemaResource - a resource that locates the schema to validate against
schemaLanguage - the language of the schema
Returns:
a validator
Throws:
java.io.IOException - if the schema resource cannot be read
java.lang.IllegalArgumentException - if the schema language is not supported
java.lang.IllegalStateException - if JAXP 1.0 cannot be located
XmlValidationException - if a XmlValidator cannot be created
See Also:
SCHEMA_RELAX_NG, SCHEMA_W3C_XML

createValidator

public static XmlValidator createValidator(org.springframework.core.io.Resource[] schemaResources,
                                           java.lang.String schemaLanguage)
                                    throws java.io.IOException
Create a XmlValidator with the given schema resources and schema language type. The schema language must be one of the SCHEMA_XXX constants.

Parameters:
schemaResources - an array of resource that locate the schemas to validate against
schemaLanguage - the language of the schemas
Returns:
a validator
Throws:
java.io.IOException - if the schema resource cannot be read
java.lang.IllegalArgumentException - if the schema language is not supported
java.lang.IllegalStateException - if JAXP 1.0 cannot be located
XmlValidationException - if a XmlValidator cannot be created
See Also:
SCHEMA_RELAX_NG, SCHEMA_W3C_XML


Copyright � 2005-2008 The Spring Web Services Framework. All Rights Reserved.