Overview | Package | Class | Tree | Deprecated | Index | Help
| oNVDL-20070517 API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.thaiopensource.relaxng
Class SchemaFactory

    java.lang.Object
      com.thaiopensource.relaxng.SchemaFactory

public class SchemaFactory
extends java.lang.Object

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(org.xml.sax.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.
`org.xml.sax.ErrorHandler` | `getErrorHandler()` Returns the `ErrorHandler` that will be used for reporting errors while creating the schema.
`boolean` | `getFeasible()`
`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(org.xml.sax.ErrorHandler eh)` Specifies the `ErrorHandler` to be used for reporting errors while creating the schema.
`void` | `setFeasible(boolean feasible)`
`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

### SchemaFactory

    public SchemaFactory()

  Constructs a schema factory.

Method Detail

### createSchema

    public Schema createSchema(org.xml.sax.InputSource in)
                        throws java.io.IOException,
                               org.xml.sax.SAXException,
                               IncorrectSchemaException

  Creates a schema by parsing an XML document. A non-null `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`.

  Parameters:
    `in` - the `InputSource` containing the XML document to be parsed; must not be `null`
  Returns:
    the `Schema` constructed from the XML document; never `null`.
  Throws:
    `java.io.IOException` - if an I/O error occurs
    `org.xml.sax.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
    `java.lang.NullPointerException` - if the current XMLReaderCreator is `null`

### setXMLReaderCreator

    public void setXMLReaderCreator(XMLReaderCreator xrc)

  Specifies the XMLReaderCreator to be used for creating `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`.

  Parameters:
    `xrc` - the `XMLReaderCreator` to be used for parsing the XML document containing the schema; may be `null`
  See Also:
    `getXMLReaderCreator()`

### getXMLReaderCreator

    public XMLReaderCreator getXMLReaderCreator()

  Returns the current `XMLReaderCreator` as specified by `setXMLReaderCreator`. If `XMLReaderCreator` has never been called, then `getXMLReaderCreator` returns null.

  Returns:
    the `XMLReaderCreator` that will be used for parsing the XML document containing the schema; may be `null`
  See Also:
    `setXMLReaderCreator(com.thaiopensource.xml.sax.XMLReaderCreator)`

### setErrorHandler

    public void setErrorHandler(org.xml.sax.ErrorHandler eh)

  Specifies the `ErrorHandler` to be used for reporting errors while creating the schema. This does not affect the error handler used for validation.

  Parameters:
    `eh` - the `ErrorHandler` to be used for reporting errors while creating the schema; may be `null`.
  See Also:
    `getErrorHandler()`

### getErrorHandler

    public org.xml.sax.ErrorHandler getErrorHandler()

  Returns the `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`.

  Returns:
    the `ErrorHandler` to be used for reporting errors while creating the schema; may be `null`.
  See Also:
    `setErrorHandler(org.xml.sax.ErrorHandler)`

### setDatatypeLibraryFactory

    public void setDatatypeLibraryFactory(DatatypeLibraryFactory dlf)

  Specifies the `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.

  Parameters:
    `dlf` - the `DatatypeLibraryFactory` to be used for handling datatypes in the schema
  See Also:
    `getDatatypeLibraryFactory()`

### getDatatypeLibraryFactory

    public DatatypeLibraryFactory getDatatypeLibraryFactory()

  Returns the `DatatypeLibraryFactory` that will be used for handling datatypes in the schema. If `setDatatypeLibraryFactory` has not been called for this `SchemaFactory`, then `getDatatypeLibraryFactory` returns `null`.

  Returns:
    the `DatatypeLibraryFactory` to be used for handling datatypes in the schema; may be null.
  See Also:
    `setDatatypeLibraryFactory(org.relaxng.datatype.DatatypeLibraryFactory)`

### setCheckIdIdref

    public void setCheckIdIdref(boolean checkIdIdref)

  Specifies whether to perform checking of ID/IDREF/IDREFS attributes in accordance with RELAX NG DTD Compatibility.

  Parameters:
    `checkIdIdref` - `true` if ID/IDREF/IDREFS checking should be performed; `false` otherwise
  See Also:
    `getCheckIdIdref()`, RELAX NG DTD Compatibility

### getCheckIdIdref

    public boolean getCheckIdIdref()

  Indicates whether ID/IDREF/IDREFS attributes will be checked in accordance RELAX NG DTD Compatibility. If `setCheckIdIdref` has not been called for this `SchemaFactory`, then `getCheckIdref` will return `false`.

  Returns:
    `true` if ID/IDREF/IDREFS attributes will be checked; `false` otherwise.
  See Also:
    `setCheckIdIdref(boolean)`, RELAX NG DTD Compatibility

### setCompactSyntax

    public void setCompactSyntax(boolean compactSyntax)

  Specifies whether to use the compact syntax to parse the RELAX NG schema rather than the normal XML syntax.

  Parameters:
    `compactSyntax` - `true` if the compact syntax should be used; `false` if the XML syntax should be used
  See Also:
    `getCompactSyntax()`

### getCompactSyntax

    public boolean getCompactSyntax()

  Indicates whether the compact syntax will be used to parse the RELAX NG schema rather than the normal XML syntax.

  Returns:
    `true` if the compact syntax will be used; `false` if the XML syntax will be used

### setFeasible

    public void setFeasible(boolean feasible)

### getFeasible

    public boolean getFeasible()

Overview | Package | Class | Tree | Deprecated | Index | Help
| oNVDL-20070517 API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© Copyright SyncRO Soft SRL 2006-2007.