|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.twicom.qdparser.XMLReader
public class XMLReader
Parses an XML structure producing the equivalent nested class structure
Field Summary | |
---|---|
(package private) java.util.Stack<TaggedElement> |
stack
Holds all the parent elements of the current element |
Constructor Summary | |
---|---|
XMLReader(java.lang.String xml)
Class constructor that reads the XML from a string |
|
XMLReader(java.lang.String comment,
java.io.Reader input)
Class constructor that reads the XML from a Reader and specifies a comment |
|
XMLReader(java.lang.String comment,
java.lang.String xml)
Class constructor that reads the XML from a string and specifies a comment |
|
XMLReader(java.lang.String comment,
java.net.URI uri)
Class constructor that reads the XML from a URI specified source and specifies a comment |
Method Summary | |
---|---|
void |
endDocument()
Called to indicate the end of the XML document being read |
void |
endElement(java.lang.String nameSpace,
java.lang.String tag)
Called to indicate the end of a tagged element |
static java.io.Reader |
openResource(java.lang.String name)
gets a local resource and returns it as a Reader input stream |
TaggedElement |
parse()
parses the XML and returns one top level XML class element |
static TaggedElement |
parse(java.lang.String xml)
|
static TaggedElement |
parse(java.lang.String comment,
java.lang.String xml)
|
void |
startDocument()
Called to indicate the start of the XML document being read |
void |
startElement(java.lang.String nameSpace,
java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attributes,
int line,
int col)
Called to indicate the start of a tagged element |
void |
text(java.lang.String str,
boolean cdata,
int line,
int col)
Called to indicate that an untagged element has been read |
void |
text(java.lang.String str,
int line,
int col)
Called to indicate that an untagged element has been read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.util.Stack<TaggedElement> stack
Constructor Detail |
---|
public XMLReader(java.lang.String xml)
xml
- the XML string to be parsedpublic XMLReader(java.lang.String comment, java.lang.String xml)
comment
- the comment to be stored with parsed elementsxml
- the XML string to be parsedpublic XMLReader(java.lang.String comment, java.io.Reader input)
comment
- the comment to be stored with parsed elementsinput
- the XML source to be parsedpublic XMLReader(java.lang.String comment, java.net.URI uri)
comment
- the comment to be stored with parsed elementsuri
- the location that contains the XML to be parsedMethod Detail |
---|
public static TaggedElement parse(java.lang.String xml)
public static TaggedElement parse(java.lang.String comment, java.lang.String xml)
public TaggedElement parse() throws XMLParseException, java.io.IOException
XMLParseException
- if an error occurs when parsing the XML
java.io.IOException
- if an error occurs when reading from the input sourcepublic void startDocument() throws XMLParseException
DocHandler
startDocument
in interface DocHandler
XMLParseException
- if a semantic error is observedpublic void endDocument() throws XMLParseException
DocHandler
endDocument
in interface DocHandler
XMLParseException
- if a semantic error is observedpublic void startElement(java.lang.String nameSpace, java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attributes, int line, int col) throws XMLParseException
DocHandler
startElement
in interface DocHandler
nameSpace
- the namespace part of the tagtag
- the name part of the tagattributes
- the table of attributes for this elementline
- the line number where this element was startedcol
- the column number where this element was started
XMLParseException
- if a semantic error is observedpublic void endElement(java.lang.String nameSpace, java.lang.String tag) throws XMLParseException
DocHandler
endElement
in interface DocHandler
nameSpace
- the namespace part of the tagtag
- the name part of the tag
XMLParseException
- if a semantic error is observedpublic void text(java.lang.String str, boolean cdata, int line, int col) throws XMLParseException
DocHandler
text
in interface DocHandler
str
- the value of the untagged elementcdata
- true if the element was a CDATA elementline
- the line number where this element was startedcol
- the column number where this element was started
XMLParseException
- if a semantic error is observedpublic void text(java.lang.String str, int line, int col) throws XMLParseException
DocHandler
text
in interface DocHandler
str
- the value of the untagged elementline
- the line number where this element was startedcol
- the column number where this element was started
XMLParseException
- if a semantic error is observedpublic static java.io.Reader openResource(java.lang.String name)
name
- the name of the resource to open
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |