public class OWLAPISimpleSAXParser extends Object
Parsing the following XML:
<?xml version='1.0' encoding='UTF-8'?> <xml-doc> <foo a="1" b="2&3"/> <bar>Hello World!</bar> </xml-doc>
will result in the following method calls to the SimpleSAXListener:
startDocument()
startTag("xml-doc", emptyMap, "")
startTag("foo", a_b_Map, "")
endTag("foo")
startTag("bar", emptyMap, "Hello World!")
endTag("bar")
endTag("xml-doc")
endDocument()
| Constructor | Description |
|---|---|
OWLAPISimpleSAXParser() |
Creates a new OWLAPISimpleSAXParser that will try to create a new XMLReader using
info.aduna.xml.XMLReaderFactory for parsing the XML.
|
OWLAPISimpleSAXParser(XMLReader xmlReader) |
Creates a new OWLAPISimpleSAXParser that will use the supplied XMLReader for parsing
the XML.
|
| Modifier and Type | Method | Description |
|---|---|---|
info.aduna.xml.SimpleSAXListener |
getListener() |
Gets the listener that currently will receive any events from this parser.
|
boolean |
isPreserveWhitespace() |
|
void |
parse(File file) |
Parses the content of the supplied File as XML.
|
void |
parse(InputStream in) |
Parses the content of the supplied InputStream as XML.
|
void |
parse(Reader reader) |
Parses the content of the supplied Reader as XML.
|
void |
setListener(info.aduna.xml.SimpleSAXListener listener) |
Sets the (new) listener that should receive any events from this parser.
|
void |
setPreserveWhitespace(boolean preserveWhitespace) |
Sets whether leading and trailing whitespace characters in text elements should be preserved.
|
public OWLAPISimpleSAXParser(XMLReader xmlReader)
xmlReader - The XMLReader to use for parsing.setListener(info.aduna.xml.SimpleSAXListener)public OWLAPISimpleSAXParser()
throws SAXException
SAXException - If the OWLAPISimpleSAXParser was unable to create an XMLReader.setListener(info.aduna.xml.SimpleSAXListener),
XMLReader,
XMLReaderFactorypublic void setListener(info.aduna.xml.SimpleSAXListener listener)
listener - The (new) listener for events from this parser.public info.aduna.xml.SimpleSAXListener getListener()
public void setPreserveWhitespace(boolean preserveWhitespace)
preserveWhitespace - preserve white spacespublic boolean isPreserveWhitespace()
public void parse(File file) throws SAXException, IOException
file - The file containing the XML to parse.SAXException - parse exceptionIOException - parse exceptionpublic void parse(InputStream in) throws SAXException, IOException
in - An InputStream containing XML data.SAXException - parse exceptionIOException - parse exceptionpublic void parse(Reader reader) throws SAXException, IOException
reader - A Reader containing XML data.SAXException - parse exceptionIOException - parse exceptionCopyright © 2018 The University of Manchester. All rights reserved.