Class InvisibleXml
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The iXML "ambiguous" state .static final String
static final String
The internal name for the discard parser attribute.static final String
The internal name for the insertion parser attribute.static final String
static final String
static final String
static final String
static final String
The Invisible XML namespace URI.static final String
The namespace prefix for the Invisilble XML namespace.static final String
The category name used for InvisibleXml log messages.static final String
The internal name for the mark parser attribute.static final String
The internal name for the name parser attribute.static final String
THe NineML namespace URI.static final String
The namespace prefix for the NineML namespace.static final String
The internal name for the tmark parser attribute.static final String
The iXML "version-mismatch" state.static final String
The internal name for the xmlns parser attribute. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new InvisibleXml object (with default options) from which parsers can be constructed.InvisibleXml
(ParserOptions options) Creates a new InvisibleXml object (with custom options) from which parsers can be constructed. -
Method Summary
Modifier and TypeMethodDescriptionGet the parser options currently being used to construct parsers.The parser for ixml grammars.Get a parser from a file.Get a parser from a file with an explicit encoding.getParser
(InputStream stream, String systemId) Get a parser from an input stream.getParser
(InputStream stream, String systemId, String encoding) Get a parser from an input stream with an explicit encoding.Get a parser from a URI.Get a parser from a URI with an explicit encoding.getParserFromIxml
(InputStream stream, String charset) Constructs a parser from an ixml grammar.getParserFromIxml
(String input) Constructs a parser from an ixml grammar.getParserFromVxml
(InputStream stream, String systemId) Construct a parser from an XML representation (vxml) of an ixml grammarThe known pragma names.The known states.static boolean
satisfiesVersion10
(String version) Is this version a valid "1.0" version?static boolean
satisfiesVersion11
(String version) Is this version a valid "1.1" version?
-
Field Details
-
logcategory
The category name used for InvisibleXml log messages.- See Also:
-
IXML_10
- See Also:
-
IXML_10_NINEML
- See Also:
-
IXML_11
- See Also:
-
IXML_11_NINEML
- See Also:
-
XMLNS_ATTRIBUTE
The internal name for the xmlns parser attribute.- See Also:
-
NAME_ATTRIBUTE
The internal name for the name parser attribute.- See Also:
-
MARK_ATTRIBUTE
The internal name for the mark parser attribute.- See Also:
-
TMARK_ATTRIBUTE
The internal name for the tmark parser attribute.- See Also:
-
INSERTION_ATTRIBUTE
The internal name for the insertion parser attribute.- See Also:
-
DISCARD_ATTRIBUTE
The internal name for the discard parser attribute.- See Also:
-
CSV_HEADING_ATTRIBUTE
- See Also:
-
ixml_prefix
The namespace prefix for the Invisilble XML namespace.- See Also:
-
ixml_ns
The Invisible XML namespace URI.- See Also:
-
nineml_prefix
The namespace prefix for the NineML namespace.- See Also:
-
nineml_ns
THe NineML namespace URI.- See Also:
-
AMBIGUOUS
The iXML "ambiguous" state .- See Also:
-
VERSION_MISMATCH
The iXML "version-mismatch" state.- See Also:
-
-
Constructor Details
-
InvisibleXml
public InvisibleXml()Creates a new InvisibleXml object (with default options) from which parsers can be constructed.Attempts to load the Invisible XML parser for Invisible XML from resources. This constructor uses default options.
- Throws:
IxmlException
- if the Invisible XML parser for Invisible XML cannot be loaded
-
InvisibleXml
Creates a new InvisibleXml object (with custom options) from which parsers can be constructed.Attempts to load the Invisible XML parser for Invisible XML from resources.
- Parameters:
options
- the parser options- Throws:
IxmlException
- if the Invisible XML parser for Invisible XML cannot be loaded
-
-
Method Details
-
knownPragmas
The known pragma names.- Returns:
- the list of pragma names known to the processor
-
knownStates
The known states.- Returns:
- the list of states known to the processor.
-
satisfiesVersion10
Is this version a valid "1.0" version?The valid 1.0 versions are "1.0" and "1.0-nineml".
- Parameters:
version
- the version string- Returns:
- true if this is a 1.0 version
-
satisfiesVersion11
Is this version a valid "1.1" version?The valid 1.1 versions are "1.1" and "1.1-nineml".
- Parameters:
version
- the version string- Returns:
- true if this is a 1.1 version
-
getOptions
Get the parser options currently being used to construct parsers.Changing properties on the options will only effect subsequently constructed parsers. Each parser gets its own copy of the options.
- Returns:
- the current options
-
getParser
The parser for ixml grammars.- Returns:
- A parser for the ixml specification grammar.
-
getParser
Get a parser from a URI.Attempts to read from the URI with
source.toURL().openConnection()
. Sniffs the first 4095 bytes of the input to identify the input as an ixml grammar, a vxml grammar, or a compiled grammar. Assumes the input is in UTF-8.- Parameters:
source
- the grammar source.- Returns:
- a parser for that grammar
- Throws:
IOException
- if attempting to open or read the source failsIxmlException
- if the source cannot be identified or is not a valid grammar
-
getParser
Get a parser from a file.Sniffs the first 4095 bytes of the input to identify the input as an ixml grammar, a vxml grammar, or a compiled grammar. Assumes the input is in UTF-8.
- Parameters:
source
- the grammar source.- Returns:
- a parser for that grammar
- Throws:
IOException
- if attempting to open or read the source failsIxmlException
- if the source cannot be identified or is not a valid grammar
-
getParser
Get a parser from a URI with an explicit encoding.Attempts to read from the URI with
source.toURL().openConnection()
. Sniffs the first 4095 bytes of the input to identify the input as an ixml grammar, a vxml grammar, or a compiled grammar. The encoding is irrelevant for vxml or compiled grammars.- Parameters:
source
- the grammar source.encoding
- the character encoding.- Returns:
- a parser for that grammar
- Throws:
IOException
- if attempting to open or read the source failsIxmlException
- if the source cannot be identified or is not a valid grammar
-
getParser
Get a parser from a file with an explicit encoding.Sniffs the first 4095 bytes of the input to identify the input as an ixml grammar, a vxml grammar, or a compiled grammar.The encoding is irrelevant for vxml or compiled grammars.
- Parameters:
source
- the grammar source.encoding
- the encoding- Returns:
- a parser for that grammar
- Throws:
IOException
- if attempting to open or read the source failsIxmlException
- if the source cannot be identified or is not a valid grammar
-
getParser
Get a parser from an input stream.Sniffs the first 4095 bytes of the input stream to identify the input as an ixml grammar, a vxml grammar, or a compiled grammar. Assumes the input is in UTF-8.
- Parameters:
stream
- the grammar sourcesystemId
- the system identifier (for XML grammars)- Returns:
- a parser for that grammar
- Throws:
IOException
- if attempting to read the source failsIxmlException
- if the source cannot be identified or is not a valid grammar
-
getParser
public InvisibleXmlParser getParser(InputStream stream, String systemId, String encoding) throws IOException Get a parser from an input stream with an explicit encoding.Sniffs the first 4095 bytes of the input stream to identify the input as an ixml grammar, a vxml grammar, or a compiled grammar. The encoding is irrelevant for vxml or compiled grammars.
- Parameters:
stream
- the grammar sourcesystemId
- the system identifier (for XML grammars)encoding
- the character encoding.- Returns:
- a parser for that grammar
- Throws:
IOException
- if attempting to open or read the source failsIxmlException
- if the source cannot be identified or is not a valid grammar
-
getParserFromVxml
Construct a parser from an XML representation (vxml) of an ixml grammar- Parameters:
stream
- the input streamsystemId
- The system ID of an XML document containing an Invisible XML vxml grammar.- Returns:
- A parser for that grammar.
- Throws:
IOException
- if the input cannot be readIxmlException
- if the input is not an ixml grammar
-
getParserFromIxml
Constructs a parser from an ixml grammar.- Parameters:
stream
- A stream returning an ixml grammar.charset
- The character set of the grammar file.- Returns:
- A parser for the grammar.
- Throws:
IOException
- If an error occurs reading the stream or if the character set is unsupported.IxmlException
- if the input is not an ixml grammar
-
getParserFromIxml
Constructs a parser from an ixml grammar.- Parameters:
input
- An input string that contains an ixml grammar.- Returns:
- A parser for the grammar.
- Throws:
IxmlException
- if the input is not an ixml grammar
-