|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.thaiopensource.relaxng.SchemaFactory
A factory for RELAX NG schemas. The factory creates Schema
objects from their
XML representation.
A single SchemaFactory
is not safe for concurrent
access by multiple threads; it must be accessed by at most one thread at a time.
Schemas can be created concurrently by using a distinct SchemaFactory
for each
thread. However, the Schema
objects created are safe for concurrent
access by multiple threads.
Constructor Summary | |
SchemaFactory()
Constructs a schema factory. |
Method Summary | |
Schema |
createSchema(InputSource in)
Creates a schema by parsing an XML document. |
boolean |
getCheckIdIdref()
Indicates whether ID/IDREF/IDREFS attributes will be checked in accordance RELAX NG DTD Compatibility. |
boolean |
getCompactSyntax()
Indicates whether the compact syntax will be used to parse the RELAX NG schema rather than the normal XML syntax. |
DatatypeLibraryFactory |
getDatatypeLibraryFactory()
Returns the DatatypeLibraryFactory that will be used for handling datatypes in the
schema. |
ErrorHandler |
getErrorHandler()
Returns the ErrorHandler that will be used for reporting errors while creating the
schema. |
XMLReaderCreator |
getXMLReaderCreator()
Returns the current XMLReaderCreator as specified by setXMLReaderCreator . |
void |
setCheckIdIdref(boolean checkIdIdref)
Specifies whether to perform checking of ID/IDREF/IDREFS attributes in accordance with RELAX NG DTD Compatibility. |
void |
setCompactSyntax(boolean compactSyntax)
Specifies whether to use the compact syntax to parse the RELAX NG schema rather than the normal XML syntax. |
void |
setDatatypeLibraryFactory(DatatypeLibraryFactory dlf)
Specifies the DatatypeLibraryFactory to be used for handling datatypes in the schema. |
void |
setErrorHandler(ErrorHandler eh)
Specifies the ErrorHandler to be used for reporting errors while creating the schema. |
void |
setXMLReaderCreator(XMLReaderCreator xrc)
Specifies the XMLReaderCreator to be used for creating XMLReader s for parsing
the XML document. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SchemaFactory()
Method Detail |
public Schema createSchema(InputSource in) throws IOException, SAXException, IncorrectSchemaException
XMLReaderCreator
must be specified
with setXMLReaderCreator
before calling createSchema
. The ErrorHandler
is allowed to be null
. The DatatypeLibraryFactory
is allowed to be null
.
Normally, if a schema cannot be created, createSchema
will throw
a IncorrectSchemaException
; however,
before doing so, one or more errors will be reported using the ErrorHandler
if it is non-null. If the
ErrorHandler
throws a SAXException
, then createSchema
will pass this
through rather than throwing a IncorrectSchemaException
. Similarly, if XMLReader.parse
throws a SAXException
or IOException
, then createSchema
will pass
this through rather than throwing a IncorrectSchemaException
. Thus, if an error handler
is specified that reports errors to the user, there is no need to report any additional message to the
user if createSchema
throws IncorrectSchemaException
.
in
- the InputSource
containing the XML document to be parsed;
must not be null
Schema
constructed from the XML document;
never null
.
IOException
- if an I/O error occurs
SAXException
- if there is an XML parsing error and the XMLReader or ErrorHandler
throws a SAXException
IncorrectSchemaException
- if the XML document was not a correct RELAX NG schema
NullPointerException
- if the current XMLReaderCreator is null
public void setXMLReaderCreator(XMLReaderCreator xrc)
XMLReader
s for parsing
the XML document. Because of include
and externalRef
elements,
parsing a single RELAX NG may require the creation of multiple more than one XMLReader
.
A non-null XMLReaderCreator must be specified before calling createSchema
.
xrc
- the XMLReaderCreator
to be used for parsing the XML document containing
the schema; may be null
getXMLReaderCreator()
public XMLReaderCreator getXMLReaderCreator()
XMLReaderCreator
as specified by setXMLReaderCreator
.
If XMLReaderCreator
has never been called, then getXMLReaderCreator
returns null.
XMLReaderCreator
that will be used for parsing the XML document containing
the schema; may be null
setXMLReaderCreator(com.thaiopensource.relaxng.XMLReaderCreator)
public void setErrorHandler(ErrorHandler eh)
ErrorHandler
to be used for reporting errors while creating the schema.
This does not affect the error handler used for validation.
eh
- the ErrorHandler
to be used for reporting errors while creating the schema;
may be null
.getErrorHandler()
public ErrorHandler getErrorHandler()
ErrorHandler
that will be used for reporting errors while creating the
schema. If setErrorHandler
has not been called for this SchemaFactory
,
then getErrorHandler
returns null
.
ErrorHandler
to be used for reporting errors while creating the schema;
may be null
.setErrorHandler(org.xml.sax.ErrorHandler)
public void setDatatypeLibraryFactory(DatatypeLibraryFactory dlf)
DatatypeLibraryFactory
to be used for handling datatypes in the schema.
This also determines how datatypes are handled during validation. If null
is
specified then only the builtin datatypes will be supported.
dlf
- the DatatypeLibraryFactory
to be used for handling datatypes in the schemagetDatatypeLibraryFactory()
public DatatypeLibraryFactory getDatatypeLibraryFactory()
DatatypeLibraryFactory
that will be used for handling datatypes in the
schema. If setDatatypeLibraryFactory
has not been called for this SchemaFactory
,
then getDatatypeLibraryFactory
returns null
.
DatatypeLibraryFactory
to be used for handling datatypes in the schema;
may be null.setDatatypeLibraryFactory(org.relaxng.datatype.DatatypeLibraryFactory)
public void setCheckIdIdref(boolean checkIdIdref)
checkIdIdref
- true
if ID/IDREF/IDREFS checking should be performed;
false
otherwisegetCheckIdIdref()
,
RELAX NG DTD Compatibilitypublic boolean getCheckIdIdref()
setCheckIdIdref
has not been called for this SchemaFactory
,
then getCheckIdref
will return false
.
true
if ID/IDREF/IDREFS attributes will be checked;
false
otherwise.setCheckIdIdref(boolean)
,
RELAX NG DTD Compatibilitypublic void setCompactSyntax(boolean compactSyntax)
compactSyntax
- true
if the compact syntax should be used; false
if the XML syntax should be usedgetCompactSyntax()
public boolean getCompactSyntax()
true
if the compact syntax will be used; false
if the XML
syntax will be used
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |