|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler wyvern.util.XMLSimple
Overrides org.xml.sax.helpers.DefaultHandler to produce an array of hashes for a given XML document. It's similar to what the DOM model produces, but it's more loosely typed, and not as fancy. It's similar to what Perl's XML::Simple->XMLin might produce.
The data structure returned from getDocument() is a tree of XMLSimple.Element objects.
Nested Class Summary | |
static class |
XMLSimple.Element
Simple representation of an XML Element. |
Constructor Summary | |
XMLSimple()
|
Method Summary | |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Notification of end of an element. |
void |
error(org.xml.sax.SAXParseException sx)
Handles errors. |
static void |
main(java.lang.String[] args)
Tests it out. |
static java.lang.String |
makePadding(int repeats)
Creates a string by concatenating N of the same character. |
void |
printTree()
Prints the tree that's been built so far for this document. |
static XMLSimple.Element |
readString(java.lang.String xml)
Reads an xml string. |
void |
startDocument()
Notification that the document is beginning. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attrs)
Constructs a new element, adding it to the children of its parent. |
void |
warning(org.xml.sax.SAXParseException sx)
Handles warnings. |
XMLSimple.Element |
xmlin(java.io.File file)
Parses an xml file. |
XMLSimple.Element |
xmlin(java.io.InputStream in)
Parses an xml input stream. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLSimple()
Method Detail |
public static XMLSimple.Element readString(java.lang.String xml) throws java.lang.Exception
java.lang.Exception
public XMLSimple.Element xmlin(java.io.File file) throws java.lang.Exception
file
- a File object representing the file to parse
java.lang.Exception
public XMLSimple.Element xmlin(java.io.InputStream in) throws java.lang.Exception
java.lang.Exception
public void startDocument()
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
public void error(org.xml.sax.SAXParseException sx)
public void warning(org.xml.sax.SAXParseException sx)
public static java.lang.String makePadding(int repeats)
public void printTree()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |