|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.samskivert.xml.SimpleParser
public class SimpleParser
The simple parser class provides an extensible object that is intended to simplify the task of writing an object to parse a particular XML file.
| Field Summary | |
|---|---|
protected StringBuilder |
_chars
The character data gathered while parsing. |
| Constructor Summary | |
|---|---|
SimpleParser()
|
|
| Method Summary | |
|---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
endElement(String uri,
String localName,
String qName)
|
protected void |
finishElement(String uri,
String localName,
String qName,
String data)
Called when parsing an element is finished and its data is fully available. |
protected InputStream |
getInputStream(String path)
Returns an input stream to read data from the given file name. |
void |
parseFile(String path)
Parse the given file. |
protected int |
parseInt(String val)
Parse the given string as an integer and return the integer value, or -1 if the string is malformed. |
void |
parseStream(InputStream stream)
Parse the given input stream. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endDocument, 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 |
| Field Detail |
|---|
protected StringBuilder _chars
| Constructor Detail |
|---|
public SimpleParser()
| Method Detail |
|---|
public void characters(char[] ch,
int start,
int length)
characters in interface ContentHandlercharacters in class DefaultHandler
public void endElement(String uri,
String localName,
String qName)
endElement in interface ContentHandlerendElement in class DefaultHandler
public void parseFile(String path)
throws IOException
path - the full path to the file to parse.
IOException - thrown if an error occurs while parsing
the file.
public void parseStream(InputStream stream)
throws IOException
stream - the input stream from which the XML source to be
parsed can be loaded.
IOException - thrown if an error occurs while parsing
the stream.
protected void finishElement(String uri,
String localName,
String qName,
String data)
endElement(java.lang.String, java.lang.String, java.lang.String)
excepting that the final complete character data is provided as
a parameter and is conveniently trimmed of any extraneous white
space.
protected InputStream getInputStream(String path)
throws IOException
IOExceptionprotected int parseInt(String val)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||