Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 1078
نمايش فراداده

SchemaFactoryjavax.xml.validation

Java 5.0

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_URL. Other schema types may also be supported, such as RELAX NG schemas, identified by XMLConstants.RELAXNG_NS_URL.

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, org.xml.sax.SAXNotSupportedException; public abstract org.w3c.dom.ls.LSResourceResolver

getResourceResolver ( ); public abstract boolean

isSchemaLanguageSupported (String

schemaLanguage ); public abstract Schema

newSchema ( ) throws org.xml.sax.SAXException; public Schema

newSchema (javax.xml.transform.Source

schema ) throws org.xml.sax.SAXException; public Schema

newSchema (java.io.File

schema ) throws org.xml.sax.SAXException; public abstract Schema

newSchema (javax.xml.transform.Source[ ]

schemas ) throws org.xml.sax.SAXException; public Schema

newSchema (java.net.URL

schema ) throws org.xml.sax.SAXException; public abstract void

setErrorHandler (org.xml.sax.ErrorHandler

errorHandler ); public void

setFeature (String

name , boolean

value ) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; public void

setProperty (String

name , Object

object ) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; public abstract void

setResourceResolver (org.w3c.dom.ls.LSResourceResolver

resourceResolver ); }

Returned By

SchemaFactoryLoader.newFactory( )