Javax.xml.validation.SchemaFactory Class



Introduction

The javax.xml.validation.SchemaFactory class is a factory that creates Schema objects.Following are the important points about validation.SchemaFactory −

  • Entry-point to the validation API.

  • SchemaFactory is a schema compiler.

  • It reads external representations of schemas and prepares them for validation.

  • The SchemaFactory class is not thread-safe.

Class declaration

Following is the declaration for javax.xml.validation.SchemaFactory class −

public abstract class SchemaFactory
   extends Object

Class constructors

S.N. Constructor & Description
1 protected SchemaFactory()

This is the constructor for derived classes.

Class methods

S.N. Method & Description
1

abstract ErrorHandler getErrorHandler()

This method gets the current ErrorHandler set to this SchemaFactory.

2

boolean getFeature(String name)

This method gets the value of a feature flag.

3

Object getProperty(String name)

This method gets the value of a property.

4

abstract LSResourceResolver getResourceResolver()

This method gets the current LSResourceResolver set to this SchemaFactory.

5

abstract boolean isSchemaLanguageSupported(String schemaLanguage)

This method states that is a specified schema supported by this SchemaFactory?

6

static SchemaFactory newInstance(String schemaLanguage)

This method lookup an implementation of the SchemaFactory that supports the specified schema language and return it.

7

static SchemaFactory newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader)

This method obtains a new instance of a SchemaFactory from class name.

8

abstract Schema newSchema()

This method creates a special Schema object.

9

Schema newSchema(File schema)

This method parses the specified File as a schema and returns it as a Schema.

10

Schema newSchema(Source schema)

This method parses the specified source as a schema and returns it as a schema.

11

abstract Schema newSchema(Source[] schemas)

This method parses the specified source(s) as a schema and returns it as a schema.

12

Schema newSchema(URL schema)

This method parses the specified URL as a schema and returns it as a Schema.

13

abstract void setErrorHandler(ErrorHandler errorHandler)

This method sets the ErrorHandler to receive errors encountered during the newSchema method invocation.

14

void setFeature(String name, boolean value)

This method sets a feature for this SchemaFactory, Schemas created by this factory, and by extension, Validators and ValidatorHandlers created by those Schemas.

15

void setProperty(String name, Object object)

This method sets the value of a property.

16

abstract void setResourceResolver(LSResourceResolver resourceResolver)

This method sets the LSResourceResolver to customize resource resolution when parsing schemas.

Methods inherited

This class inherits methods from the following classes −

java.lang.Object

Advertisements