Name

SchemaFactory

Synopsis

A SchemaFactory parses the textual representation of a schema into a Schema object. Obtain a SchemaFactory with the newInstance( ) method, passing a string that identifies the type of schema you want to parse. All implementations are required to support the W3C XML Schema language, which is identified by XMLConstants.W3C_XML_SCHEMA_NS_URI. Other schema types may also be supported, such as RELAX NG schemas, identified by XMLConstants.RELAXNG_NS_URI.

To parse a schema, call the newSchema( ) method, passing the File or javax.xml.transform.Source object that identifies the schema contents. For schemas in the W3C XML Schema language, you may also specify an array of Source objects that contain the schema definition. If you call newSchema( ) with no arguments, a special Schema object is returned that expects the document to specify the location of its own W3C XML Schema.

You can configure a SchemaFactory before calling newSchema( ) with setErrorHandler( ) , setResourceResolver( ), setProperty( ), and setFeature( ) .

public abstract class SchemaFactory {
// Protected Constructors
     protected SchemaFactory( );  
// Public Class Methods
     public static final SchemaFactory newInstance(String schemaLanguage);  
// Public Instance Methods
     public abstract org.xml.sax.ErrorHandler getErrorHandler( );  
     public boolean getFeature(String name) 
        throws org.xml.sax.SAXNotRecognizedException, 
        org.xml.sax.SAXNotSupportedException;  
     public Object getProperty(String name) throws org.xml.sax.SAXNotRecognizedException, ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.