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 |
| Modifier and Type | Field and Description |
|---|---|
| private Controller | |
| private SAXParserFactory | |
| private ExpressionPool | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private Grammar | |
| public Controller | |
| public ExpressionPool | |
| public SAXParserFactory | |
| public boolean | |
| private boolean | |
| public static Grammar | Returns: null if there was an error in the grammar.parses the specified schema and returns the result as a Grammar object. |
| public static Grammar | |
| public static Grammar | loadSchema(String source, GrammarReaderController controller)
returns a thread-safe AGM object, depending on the language used. |
| public static Grammar | loadSchema(InputSource source, GrammarReaderController controller)
returns a thread-safe AGM object, depending on the language used. |
| public static Grammar | Returns: a non-null valid Grammar.parses the specified schema and returns the result as a Grammar object. |
| public static Grammar | |
| public static REDocumentDeclaration | Returns: null if there was an error in the grammar.parses the specified schema and returns the result as a VGM. |
| public static REDocumentDeclaration | |
| public static REDocumentDeclaration | |
| public static REDocumentDeclaration | |
| public Grammar | |
| public Grammar | |
| public REDocumentDeclaration | |
| public REDocumentDeclaration | |
| public void | setController(GrammarReaderController controller)
sets the GrammarReaderController object that will control various aspects of the parsing. |
| public void | setPool(ExpressionPool pool)
Sets the ExpressionPool object that will be used during the loading process. |
| public void | setSAXParserFactory(SAXParserFactory factory)
sets the factory object which is used to create XML parsers to parse schema files. |
| public void | |
| private static REDocumentDeclaration |
| controller | back to summary |
|---|---|
| private Controller controller | |
| factory | back to summary |
|---|---|
| private SAXParserFactory factory | |
| pool | back to summary |
|---|---|
| private ExpressionPool pool | |
| strictCheck | back to summary |
|---|---|
| private boolean strictCheck | |
| GrammarLoader | back to summary |
|---|---|
| public GrammarLoader() | |
| _loadSchema | back to summary |
|---|---|
| private Grammar _loadSchema(Object source) throws SAXException, ParserConfigurationException, IOException Actual "meat" of parsing schema. All other methods will ultimately come down to this method. | |
| getController | back to summary |
|---|---|
| public Controller getController() | |
| getPool | back to summary |
|---|---|
| public ExpressionPool getPool() | |
| getSAXParserFactory | back to summary |
|---|---|
| public SAXParserFactory getSAXParserFactory() | |
| getStrictCheck | back to summary |
|---|---|
| public boolean getStrictCheck() | |
| hasDTDextension | back to summary |
|---|---|
| private boolean hasDTDextension(String name) Checks if the specified name has ".dtd" extension. | |
| loadSchema | back to summary |
|---|---|
| public static Grammar loadSchema(String url, GrammarReaderController controller, SAXParserFactory factory) throws SAXException, ParserConfigurationException, IOException parses the specified schema and returns the result as a Grammar object.
| |
| loadSchema | back to summary |
|---|---|
| public static Grammar loadSchema(InputSource source, GrammarReaderController controller, SAXParserFactory factory) throws SAXException, ParserConfigurationException, IOException | |
| loadSchema | back to summary |
|---|---|
| public static Grammar loadSchema(String source, GrammarReaderController controller) throws SAXException, ParserConfigurationException, IOException returns a thread-safe AGM object, depending on the language used. | |
| loadSchema | back to summary |
|---|---|
| public static Grammar loadSchema(InputSource source, GrammarReaderController controller) throws SAXException, ParserConfigurationException, IOException returns a thread-safe AGM object, depending on the language used. | |
| loadSchema | back to summary |
|---|---|
| public static Grammar loadSchema(String url) throws SAXException, ParserConfigurationException, IOException parses the specified schema and returns the result as a Grammar object. This method uses the default SAX parser and throws an exception if there is an error in the schema.
| |
| loadSchema | back to summary |
|---|---|
| public static Grammar loadSchema(InputSource source) throws SAXException, ParserConfigurationException, IOException | |
| loadVGM | back to summary |
|---|---|
| public static REDocumentDeclaration loadVGM(String url, GrammarReaderController controller, SAXParserFactory factory) throws SAXException, ParserConfigurationException, IOException parses the specified schema and returns the result as a VGM. This method is an utility method for those applications which don't need AGM (e.g., a single thread application).
| |
| loadVGM | back to summary |
|---|---|
| public static REDocumentDeclaration loadVGM(InputSource source, GrammarReaderController controller, SAXParserFactory factory) throws SAXException, ParserConfigurationException, IOException | |
| loadVGM | back to summary |
|---|---|
| public static REDocumentDeclaration loadVGM(String url) throws SAXException, ParserConfigurationException, IOException parses the specified schema and returns the result as a VGM. This method uses the default SAX parser and throws an exception if there is an error in the schema.
| |
| loadVGM | back to summary |
|---|---|
| public static REDocumentDeclaration loadVGM(InputSource source) throws SAXException, ParserConfigurationException, IOException | |
| parse | back to summary |
|---|---|
| public Grammar parse(InputSource source) throws SAXException, ParserConfigurationException, IOException | |
| parse | back to summary |
|---|---|
| public Grammar parse(String url) throws SAXException, ParserConfigurationException, IOException | |
| parseVGM | back to summary |
|---|---|
| public REDocumentDeclaration parseVGM(String url) throws SAXException, ParserConfigurationException, IOException | |
| parseVGM | back to summary |
|---|---|
| public REDocumentDeclaration parseVGM(InputSource source) throws SAXException, ParserConfigurationException, IOException | |
| setController | back to summary |
|---|---|
| public void setController(GrammarReaderController controller) sets the GrammarReaderController object that will control various aspects of the parsing. If not set, no error report will be done. | |
| setPool | back to summary |
|---|---|
| public void setPool(ExpressionPool pool) Sets the ExpressionPool object that will be used during the loading process. If not set, a fresh one is used for each time the loadXXX method is called. | |
| setSAXParserFactory | back to summary |
|---|---|
| public void setSAXParserFactory(SAXParserFactory factory) sets the factory object which is used to create XML parsers to parse schema files. The factory must be configured to namespace aware. If no SAXParserFactory is set, then the default parser is used. (The parser that can be obtained by SAXParserFactory.newInstance()). | |
| setStrictCheck | back to summary |
|---|---|
| public void setStrictCheck(boolean value) Sets the strict check flag. If set to true, schema readers will apply stricter checks so that it can find errors in the schema. If set to false, readers will skip some of the checks. When this flag is set to false, which is the default, the reader may accept incorrect schemas. | |
| wrapByVGM | back to summary |
|---|---|
| private static REDocumentDeclaration wrapByVGM(Grammar g) | |
| Modifier and Type | Field and Description |
|---|---|
| public final SAXException |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| e | back to summary |
|---|---|
| public final SAXException e | |
| GrammarLoaderException | back to summary |
|---|---|
| pack-priv GrammarLoaderException(SAXException e) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | error(Locator[] locs, String errorMessage, Exception nestedException)
Implements com. |
| public InputSource | resolveEntity(String
The public identifier of the external entity
being referenced, or null if none was supplied. p, String The system identifier of the external entity
being referenced. s)Implements org. |
| public void | warning(Locator[] locs, String errorMessage)
Implements com. |
| ThrowController | back to summary |
|---|---|
| private ThrowController() | |
| error | back to summary |
|---|---|
| public void error(Locator[] locs, String errorMessage, Exception nestedException) Implements com. | |
| resolveEntity | back to summary |
|---|---|
| public InputSource resolveEntity(String p, String s) Implements org. Doc from org. Allow the application to resolve external entities. The parser will call this method before opening any external entity except the top-level document entity. Such entities include the external DTD subset and external parameter entities referenced within the DTD (in either case, only if the parser reads external parameter entities), and external general entities referenced within the document element (if the parser reads external general entities). The application may request that the parser locate the entity itself, that it use an alternative URI, or that it use data provided by the application (as a character or byte input stream). Application writers can use this method to redirect external system identifiers to secure and/or local URIs, to look up public identifiers in a catalogue, or to read an entity from a database or other input source (including, for example, a dialog box). Neither XML nor SAX specifies a preferred policy for using public or system IDs to resolve resources. However, SAX specifies how to interpret any InputSource returned by this method, and that if none is returned, then the system ID will be dereferenced as a URL. If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to the application.
| |
| warning | back to summary |
|---|---|
| public void warning(Locator[] locs, String errorMessage) Implements com. | |