public class GrammarLoader
extends java.lang.Object
The static version of loadVGM/loadSchema methods provides simple ways to load a grammar.
Another way to use GrammarLoader is
Modifier and Type | Class and Description |
---|---|
private static class |
GrammarLoader.GrammarLoaderException
wrapper exception so that we can throw it from the GrammarReaderController.
|
private static class |
GrammarLoader.ThrowController |
Modifier and Type | Field and Description |
---|---|
private Controller |
controller |
private javax.xml.parsers.SAXParserFactory |
factory |
private ExpressionPool |
pool |
private boolean |
strictCheck |
Constructor and Description |
---|
GrammarLoader() |
Modifier and Type | Method and Description |
---|---|
private Grammar |
_loadSchema(java.lang.Object source)
Actual "meat" of parsing schema.
|
Controller |
getController() |
ExpressionPool |
getPool() |
javax.xml.parsers.SAXParserFactory |
getSAXParserFactory() |
boolean |
getStrictCheck() |
private boolean |
hasDTDextension(java.lang.String name)
Checks if the specified name has ".dtd" extension.
|
static Grammar |
loadSchema(org.xml.sax.InputSource source) |
static Grammar |
loadSchema(org.xml.sax.InputSource source,
GrammarReaderController controller)
returns a thread-safe AGM object, depending on the language used.
|
static Grammar |
loadSchema(org.xml.sax.InputSource source,
GrammarReaderController controller,
javax.xml.parsers.SAXParserFactory factory) |
static Grammar |
loadSchema(java.lang.String url)
parses the specified schema and returns the result as a Grammar object.
|
static Grammar |
loadSchema(java.lang.String source,
GrammarReaderController controller)
returns a thread-safe AGM object, depending on the language used.
|
static Grammar |
loadSchema(java.lang.String url,
GrammarReaderController controller,
javax.xml.parsers.SAXParserFactory factory)
parses the specified schema and returns the result as a Grammar object.
|
static REDocumentDeclaration |
loadVGM(org.xml.sax.InputSource source) |
static REDocumentDeclaration |
loadVGM(org.xml.sax.InputSource source,
GrammarReaderController controller,
javax.xml.parsers.SAXParserFactory factory) |
static REDocumentDeclaration |
loadVGM(java.lang.String url)
parses the specified schema and returns the result as a VGM.
|
static REDocumentDeclaration |
loadVGM(java.lang.String url,
GrammarReaderController controller,
javax.xml.parsers.SAXParserFactory factory)
parses the specified schema and returns the result as a VGM.
|
Grammar |
parse(org.xml.sax.InputSource source) |
Grammar |
parse(java.lang.String url) |
REDocumentDeclaration |
parseVGM(org.xml.sax.InputSource source) |
REDocumentDeclaration |
parseVGM(java.lang.String url) |
void |
setController(GrammarReaderController controller)
sets the GrammarReaderController object that will control
various aspects of the parsing.
|
void |
setPool(ExpressionPool pool)
Sets the ExpressionPool object that will be used during the loading process.
|
void |
setSAXParserFactory(javax.xml.parsers.SAXParserFactory factory)
sets the factory object which is used to create XML parsers
to parse schema files.
|
void |
setStrictCheck(boolean value)
Sets the strict check flag.
|
private static REDocumentDeclaration |
wrapByVGM(Grammar g) |
private javax.xml.parsers.SAXParserFactory factory
private Controller controller
private ExpressionPool pool
private boolean strictCheck
public static REDocumentDeclaration loadVGM(java.lang.String url, GrammarReaderController controller, javax.xml.parsers.SAXParserFactory factory) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static REDocumentDeclaration loadVGM(org.xml.sax.InputSource source, GrammarReaderController controller, javax.xml.parsers.SAXParserFactory factory) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
private static REDocumentDeclaration wrapByVGM(Grammar g)
public static REDocumentDeclaration loadVGM(java.lang.String url) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static REDocumentDeclaration loadVGM(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static Grammar loadSchema(java.lang.String url, GrammarReaderController controller, javax.xml.parsers.SAXParserFactory factory) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static Grammar loadSchema(org.xml.sax.InputSource source, GrammarReaderController controller, javax.xml.parsers.SAXParserFactory factory) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static Grammar loadSchema(java.lang.String source, GrammarReaderController controller) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static Grammar loadSchema(org.xml.sax.InputSource source, GrammarReaderController controller) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static Grammar loadSchema(java.lang.String url) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public static Grammar loadSchema(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public void setSAXParserFactory(javax.xml.parsers.SAXParserFactory factory)
If no SAXParserFactory is set, then the default parser is used. (The parser that can be obtained by SAXParserFactory.newInstance()).
public javax.xml.parsers.SAXParserFactory getSAXParserFactory()
public void setController(GrammarReaderController controller)
public Controller getController()
public void setPool(ExpressionPool pool)
public ExpressionPool getPool()
public void setStrictCheck(boolean value)
When this flag is set to false, which is the default, the reader may accept incorrect schemas.
public boolean getStrictCheck()
public Grammar parse(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public Grammar parse(java.lang.String url) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public REDocumentDeclaration parseVGM(java.lang.String url) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
public REDocumentDeclaration parseVGM(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
private boolean hasDTDextension(java.lang.String name)
private Grammar _loadSchema(java.lang.Object source) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException