|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xwt.util.XML
An Event-Driving, Non-Validating XML Parser with Namespace support. A subclass can implement the abstract functions for receiving details about an xml file as it is parsed. To initate a parse, use the parse() function.
As the parser traverses into an element, it adds it to the linked list called elements. However, elements has been pre-filled with instances of the Element inner class. So in the vast majority of cases, the pointer current is moved along one, and the values for the new element are filled into the current object.
This parser supports all the unicode ranges required by the XML Specification. However, it is optimised for well-formed ASCII documents. Documents containing unicode Names and Attributes will take much longer to process, and invalid documents (badly formed Names or invalid attributes) will be run through a test on every single unicode character range before being declared invalid.
XML-Specification-1.0 http://w3.org/TR/REC-xml
Nested Class Summary | |
static class |
XML.Element
Used as a struct for holding information about a current element, and acts as a linked list entry. |
static class |
XML.MarkupException
Violation of Markup restrictions in XML Specification - Fatal Error |
static class |
XML.NCException
Namespace Constraint Violation - Recoverable Error |
static class |
XML.SchemaException
Schema Violation - Fatal Error |
static class |
XML.WFCException
Well-Formedness Constraint Violation - Fatal Error |
static class |
XML.XMLException
Parse or Structural Error |
Field Summary | |
static int |
BUFFER_SIZE
|
Constructor Summary | |
XML()
|
|
XML(int bSize)
|
Method Summary | |
abstract void |
characters(char[] ch,
int start,
int length)
Represents a line of character data. |
abstract void |
endElement(XML.Element e)
Represents the end of an Element. |
int |
getCol()
Returns the column number at the beginning of the last process call. |
int |
getLine()
Returns the line number at the beginning of the last process call. |
void |
parse(java.io.Reader reader)
Parse given input and call the abstract event functions. |
abstract void |
startElement(XML.Element e)
Called when the start of an element is processed. |
abstract void |
whitespace(char[] ch,
int start,
int length)
Represents a line of ignorable whitespace. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BUFFER_SIZE
Constructor Detail |
public XML()
public XML(int bSize)
Method Detail |
public int getLine()
public int getCol()
public final void parse(java.io.Reader reader) throws java.io.IOException, XML.XMLException
java.io.IOException
XML.XMLException
public abstract void startElement(XML.Element e) throws XML.SchemaException
The array of Attribute names and values may be longer than the number of entries they contain, but all the entries will be packed at the top.
DO NOT store a reference to the attribute arrays, as they are reused by other elements.
XML.SchemaException
public abstract void characters(char[] ch, int start, int length) throws XML.SchemaException
Newlines are all normalised to the Unix \n as per the XML Spec, and a newline will only appear as the last character in the passed array segment.
XML.getLine() and XML.getCol() report the position at the beginning of this character segment, which can be processed in a line-by-line fashion due to the above newline restriction.
XML.SchemaException
public abstract void whitespace(char[] ch, int start, int length) throws XML.SchemaException
XML.SchemaException
public abstract void endElement(XML.Element e) throws XML.SchemaException
XML.SchemaException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |