Top Description Fields Constructors
org.jdom2.input.sax

public Class XMLReaderXSDFactory

extends AbstractReaderXSDFactory
Class Inheritance
Imports
java.io.File, java.net.URL, javax.xml.XMLConstants, javax.xml.parsers.SAXParserFactory, javax.xml.transform.Source, javax.xml.validation.SchemaFactory, org.jdom2.JDOMException

This XMLReaderJDOMFactory class returns XMLReaders configured to validate against the supplied XML Schema (XSD) instance. The SAX Parser is obtained through the JAXP process.

This class has var-arg constructors, accepting potentially many XSD sources. It is just as simple though to have a single source:

File xsdfile = new File("schema.xsd");
XMLReaderJDOMFactory schemafac = new XMLReaderXSDFactory(xsdfile);
SAXBuilder builder = new SAXBuilder(schemafac);
File xmlfile = new File("data.xml");
Document validdoc = builder.build(xmlfile);
Author
Rolf Lear
See Also
org.jdom2.input.sax

Field Summary

Modifier and TypeField and Description
private static final AbstractReaderXSDFactory.SchemaFactoryProvider

Constructor Summary

AccessConstructor and Description
public
XMLReaderXSDFactory(String...
The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate
systemid
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from SystemID references.

public
XMLReaderXSDFactory(final String
The name of the SAXParserFactory class to use
factoryClassName
,
final ClassLoader
The classLoader to use for loading the SAXParserFactory.
classloader
,
final String...
The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate
systemid
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from SystemID references, and use the specified JAXP SAXParserFactory.

public
XMLReaderXSDFactory(URL...
The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate
systemid
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from URL references.

public
XMLReaderXSDFactory(final String
The name of the SAXParserFactory class to use
factoryClassName
,
final ClassLoader
The classLoader to use for loading the SAXParserFactory.
classloader
,
URL...
The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate
systemid
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from URL references, and use the specified JAXP SAXParserFactory.

public
XMLReaderXSDFactory(File...
The var-arg array of at least one SystemID reference (File) to locate the XSD's used to validate
systemid
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from File references.

public
XMLReaderXSDFactory(final String
The name of the SAXParserFactory class to use
factoryClassName
,
final ClassLoader
The classLoader to use for loading the SAXParserFactory.
classloader
,
File...
The var-arg array of at least one SystemID reference (File) to locate the XSD's used to validate
systemid
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from File references, and use the specified JAXP SAXParserFactory.

public
XMLReaderXSDFactory(Source...
The var-arg array of at least one transform Source reference to locate the XSD's used to validate
sources
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from Transform Source references.

public
XMLReaderXSDFactory(final String
The name of the SAXParserFactory class to use
factoryClassName
,
final ClassLoader
The classLoader to use for loading the SAXParserFactory.
classloader
,
Source...
The var-arg array of at least one transform Source reference to locate the XSD's used to validate
sources
)

Create an XML Schema validating XMLReader factory using one or more XSD sources from Transform Source references, and use the specified JAXP SAXParserFactory.

Field Detail

xsdschemasback to summary
private static final AbstractReaderXSDFactory.SchemaFactoryProvider xsdschemas

Constructor Detail

XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(String... systemid) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from SystemID references.

Parameters
systemid:String[]

The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the SystemIDs This will wrap a SAXException that contains the actual fault.
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(final String factoryClassName, final ClassLoader classloader, final String... systemid) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from SystemID references, and use the specified JAXP SAXParserFactory.

Parameters
factoryClassName:String

The name of the SAXParserFactory class to use

classloader:ClassLoader

The classLoader to use for loading the SAXParserFactory.

systemid:String[]

The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the SystemIDs This will wrap a SAXException that contains the actual fault.
Since
2.0.3
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(URL... systemid) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from URL references.

Parameters
systemid:URL[]

The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the SystemIDs This will wrap a SAXException that contains the actual fault.
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(final String factoryClassName, final ClassLoader classloader, URL... systemid) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from URL references, and use the specified JAXP SAXParserFactory.

Parameters
factoryClassName:String

The name of the SAXParserFactory class to use

classloader:ClassLoader

The classLoader to use for loading the SAXParserFactory.

systemid:URL[]

The var-arg array of at least one SystemID reference (URL) to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the SystemIDs This will wrap a SAXException that contains the actual fault.
Since
2.0.3
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(File... systemid) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from File references.

Parameters
systemid:File[]

The var-arg array of at least one SystemID reference (File) to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the SystemIDs This will wrap a SAXException that contains the actual fault.
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(final String factoryClassName, final ClassLoader classloader, File... systemid) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from File references, and use the specified JAXP SAXParserFactory.

Parameters
factoryClassName:String

The name of the SAXParserFactory class to use

classloader:ClassLoader

The classLoader to use for loading the SAXParserFactory.

systemid:File[]

The var-arg array of at least one SystemID reference (File) to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the SystemIDs This will wrap a SAXException that contains the actual fault.
Since
2.0.3
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(Source... sources) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from Transform Source references.

Parameters
sources:Source[]

The var-arg array of at least one transform Source reference to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the Sources This will wrap a SAXException that contains the actual fault.
XMLReaderXSDFactoryback to summary
public XMLReaderXSDFactory(final String factoryClassName, final ClassLoader classloader, Source... sources) throws JDOMException

Create an XML Schema validating XMLReader factory using one or more XSD sources from Transform Source references, and use the specified JAXP SAXParserFactory.

Parameters
factoryClassName:String

The name of the SAXParserFactory class to use

classloader:ClassLoader

The classLoader to use for loading the SAXParserFactory.

sources:Source[]

The var-arg array of at least one transform Source reference to locate the XSD's used to validate

Exceptions
JDOMException:
If the Schemas could not be loaded from the Sources This will wrap a SAXException that contains the actual fault.
Since
2.0.3