|
GXPARSE hosted by |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectca.gorman.xml.parse.sax.XMLParser<T>
public abstract class XMLParser<T extends Global>
A Parser to support the
Listener interface for parsing
XML documents. Uses SAXAdapter
to support the Listener interface.
| Constructor Summary | |
|---|---|
protected |
XMLParser(SAXParser saxParser)
Construct on an instance of javax.xml.parsers.SAXParser. |
protected |
XMLParser(SAXParserFactory factory)
Construct on an instance of javax.xml.parsers.SAXParserFactory. |
protected |
XMLParser(XMLReader xmlReader)
Construct directly on an instance of org.xml.sax.XMLReader. |
| Method Summary | ||
|---|---|---|
Element |
getCurrentElement()
Get the element that is on top of the element stack. |
|
Element[] |
getElementStack()
Get the element stack as an array. |
|
boolean |
getFeature(String name)
Look up the state of a feature. |
|
T |
getGlobal()
Get the instance of Global, if one was provided to the
Parser. |
|
Listener<Parser<T>> |
getListener()
Get Listener. |
|
Location |
getLocation()
Get information about the current location of the Parser
in the input stream. |
|
Object |
getProperty(String name)
Look up the state of a property. |
|
boolean |
isParsing(QName qName)
Indicate whether a particular element is currently being parsed. |
|
static
|
newInstance(SAXParserFactory factory)
Create an XMLParser. |
|
void |
parse(Input input)
Parse a document, without making an instance of Global
accessible to all Listener methods. |
|
void |
parse(Input input,
T global)
Parse a document, making an instance of Global accessible
to all Listener methods. |
|
void |
setFeature(String name,
boolean value)
Set the state of a feature. |
|
void |
setListener(Listener<Parser<T>> listener)
Set Listener. |
|
void |
setProperty(String name,
Object value)
Set the state of a property. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected XMLParser(XMLReader xmlReader)
Construct directly on an instance of
org.xml.sax.XMLReader.
A Listener must be installed by
setListener.
NullPointerException - if xmlReader is null
protected XMLParser(SAXParser saxParser)
throws SAXException
Construct on an instance of javax.xml.parsers.SAXParser.
A Listener must be installed by
setListener.
NullPointerException - if saxParser is null
SAXException
protected XMLParser(SAXParserFactory factory)
throws ParserConfigurationException,
SAXException
Construct on an instance of javax.xml.parsers.SAXParserFactory.
A Listener must be installed by
setListener.
NullPointerException - if factory is null
ParserConfigurationException
SAXException| Method Detail |
|---|
public static <T extends Global> XMLParser<T> newInstance(SAXParserFactory factory)
throws ParserConfigurationException,
SAXException
Create an XMLParser.
A Listener must be installed by
setListener.
ParserConfigurationException
SAXException
public boolean getFeature(String name)
throws SAXNotRecognizedException,
SAXNotSupportedException
Look up the state of a feature.
Delegates to org.xml.sax.XMLReader.getFeature.
SAXNotRecognizedException
SAXNotSupportedException
public void setFeature(String name,
boolean value)
throws SAXNotRecognizedException,
SAXNotSupportedException
Set the state of a feature.
Delegates to org.xml.sax.XMLReader.setFeature(String).
// @see org.xml.sax.XMLReader.setFeature(String)
SAXNotRecognizedException
SAXNotSupportedException
public Object getProperty(String name)
throws SAXNotRecognizedException,
SAXNotSupportedException
Look up the state of a property.
Delegates to org.xml.sax.XMLReader.getProperty(String).
// @see org.xml.sax.XMLReader.getFeature(String)
SAXNotRecognizedException
SAXNotSupportedException
public void setProperty(String name,
Object value)
throws SAXNotRecognizedException,
SAXNotSupportedException
Set the state of a property.
Delegates to org.xml.sax.XMLReader.setProperty(String).
// @see org.xml.sax.XMLReader.setProperty(String)
SAXNotRecognizedException
SAXNotSupportedException
public void parse(Input input)
throws ListenerException,
ParseException,
IOException
Parser
Parse a document, without making an instance of Global
accessible to all Listener methods.
parse in interface Parser<T extends Global>input - an Input that has been initialized to
identify a source for an XML document
ListenerException - if the Listener throws
ListenerException
ParseException - if any component of the Parser
throws an exception
IOException - if the Parser throws
IOException while reading input or the
Listener throws IOException while
writing output.public T getGlobal()
Parser
Get the instance of Global, if one was provided to the
Parser.
getGlobal in interface Parser<T extends Global>Global, or null.
public void parse(Input input,
T global)
throws ListenerException,
ParseException,
IOException
Parser
Parse a document, making an instance of Global accessible
to all Listener methods.
parse in interface Parser<T extends Global>input - an Input that has been initialized to
identify a source for an XML documentglobal - an instance Global, or null.
ListenerException - if the Listener throws
ListenerException
ParseException - if any component of the Parser
throws an exception
IOException - if the Parser throws
IOException while reading input or the
Listener throws IOException while
writing output.public Listener<Parser<T>> getListener()
Parser
Get Listener.
getListener in interface Parser<T extends Global>public void setListener(Listener<Parser<T>> listener)
Parser
Set Listener.
setListener in interface Parser<T extends Global>listener - that will receive information from the parser.public Element getCurrentElement()
ParserGet the element that is on top of the element stack.
getCurrentElement in interface Parser<T extends Global>public Element[] getElementStack()
ParserGet the element stack as an array.
getElementStack in interface Parser<T extends Global>public boolean isParsing(QName qName)
ParserIndicate whether a particular element is currently being parsed.
isParsing in interface Parser<T extends Global>true if the named element is currently being
parsed, false otherwisepublic Location getLocation()
Parser
Get information about the current location of the Parser
in the input stream. The information is valid only during the
invocation of a Listener method.
getLocation in interface Parser<T extends Global>Location when the parser is active, null when
the parser is not active
|
GXPARSE download | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||