|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler com.bbn.openmap.util.AbstractXmlParser
public abstract class AbstractXmlParser
Base class for xml parsing
Constructor Summary | |
---|---|
AbstractXmlParser()
|
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
Handle multiple callbacks per element, which will happen when the data includes xml escape sequences. |
void |
collectCharacters(java.lang.String expectedElement)
Inform the parser that we want to start gathering up the character data for the current element. |
java.lang.String |
getCollectedCharacters(java.lang.String expectedElement)
Get the final string accumulated from all invocations of characters(char[], int, int) since the last call to collectCharacters(java.lang.String) . |
boolean |
parseXmlResource(java.io.File file)
Parse an XML resource by url. |
boolean |
parseXmlResource(java.lang.Object resourceName,
org.xml.sax.InputSource source)
Parse from the given source. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractXmlParser()
Method Detail |
---|
public boolean parseXmlResource(java.io.File file)
file
- The file to parse.
public boolean parseXmlResource(java.lang.Object resourceName, org.xml.sax.InputSource source)
resourceName
- The resource name to use in warning messages.source
- The source of the xml input.
public void collectCharacters(java.lang.String expectedElement)
DefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
with the localName as the parameter.
Use getCollectedCharacters(java.lang.String)
, typically in the corresponding
DefaultHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
, to retrieve the result.
expectedElement
- The element whose character data we're gathering.
Caller must pass the same element to
getCollectedCharacters(java.lang.String)
to ensure consistency.public java.lang.String getCollectedCharacters(java.lang.String expectedElement)
characters(char[], int, int)
since the last call to collectCharacters(java.lang.String)
.
expectedElement
- The element whose character data we're gathering.
Caller must pass the same element to collectCharacters(java.lang.String)
to
ensure consistency.
characters(char[], int, int)
.
java.lang.RuntimeException
- if the expectedElement doesn't match.public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |