|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.microstar.xml.HandlerBase
|
+--edu.ucsb.adl.reports.ValidatingXmlParser
High-performance, DTD-based, table-driven validating XML parser.
This parser adds validation to the Ælfred lightweight
(non-validating) XML parser. The validation is performed against a
DTD supplied directly to the parser; any DTD information contained
within documents being parsed is ignored. The supplied DTD must
have been preprocessed into tabular form by class .
edu.ucsb.adl.reports.DtdTableGenerator
Only a subset of XML is supported. The subset includes: elements;
the element, pure #PCDATA, mixed, and
EMPTY element content models; attributes; the
CDATA and enumerated attribute content types; and
attribute requiredness and default values. The ANY
element content model is supported only to the extent that it is
recognized and such content is skipped over. Namespaces, other
attribute content types, XML schemas, and obscure XML features
(processing instructions, etc.) are not supported.
$Log: ValidatingXmlParser.java,v $
Revision 1.2 2003/03/18 17:56:30 gjanee
Added location information to low-level parse error
exceptions.
Revision 1.1 2003/03/17 20:07:08 gjanee
Initial revision
| Constructor Summary | |
ValidatingXmlParser(edu.ucsb.adl.reports.XmlDtd dtd,
int stackSize,
edu.ucsb.adl.reports.XmlHandler handler)
Creates a ValidatingXmlParser. |
|
| Method Summary | |
void |
attribute(java.lang.String name,
java.lang.String value,
boolean isSpecified)
For use by XmlParser only. |
void |
charData(char[] string,
int start,
int length)
For use by XmlParser only. |
void |
endElement(java.lang.String elementName)
For use by XmlParser only. |
void |
parse(java.io.Reader reader)
Parses a document with respect to a DTD. |
java.lang.Object |
resolveEntity(java.lang.String publicID,
java.lang.String systemID)
For use by XmlParser only. |
void |
startElement(java.lang.String elementName)
For use by XmlParser only. |
| Methods inherited from class com.microstar.xml.HandlerBase |
doctypeDecl, endDocument, endExternalEntity, error, ignorableWhitespace, processingInstruction, startDocument, startExternalEntity |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ValidatingXmlParser(edu.ucsb.adl.reports.XmlDtd dtd,
int stackSize,
edu.ucsb.adl.reports.XmlHandler handler)
ValidatingXmlParser. The parser may be
invoked multiple times (whether it returns normally or throws
an exception), but it is not multithread-safe.
dtd - The XML DTD to validate against. This argument is not checked
for errors.stackSize - The size of the parse stack. For non-recursive DTDs, a
sufficient size is the maximum element nesting depth plus one.handler - The event handler to invoke when parsing a document.
java.lang.NullPointerException - If dtd or handler is
null.
java.lang.IllegalArgumentException - If stackSize is less than 2.| Method Detail |
public void parse(java.io.Reader reader)
throws XmlException
reader - The primary source of the document.
XmlException - If any parser or validation error occurs, or if an I/O error
occurs reading from reader.
public java.lang.Object resolveEntity(java.lang.String publicID,
java.lang.String systemID)
XmlParser only.
resolveEntity in interface com.microstar.xml.XmlHandlerresolveEntity in class com.microstar.xml.HandlerBasepublicID - Unused.systemID - Unused.
public void startElement(java.lang.String elementName)
throws XmlException
XmlParser only.
startElement in interface com.microstar.xml.XmlHandlerstartElement in class com.microstar.xml.HandlerBaseelementName - The name of the new element.
XmlException - If any error occurs.
public void endElement(java.lang.String elementName)
throws XmlException
XmlParser only.
endElement in interface com.microstar.xml.XmlHandlerendElement in class com.microstar.xml.HandlerBaseelementName - The name of the current element.
XmlException - If any error occurs.
public void charData(char[] string,
int start,
int length)
throws XmlException
XmlParser only.
charData in interface com.microstar.xml.XmlHandlercharData in class com.microstar.xml.HandlerBasestring - A fragment of element text.start - The position at which the fragment starts.length - The length of the fragment.
XmlException - If any error occurs.
public void attribute(java.lang.String name,
java.lang.String value,
boolean isSpecified)
XmlParser only.
attribute in interface com.microstar.xml.XmlHandlerattribute in class com.microstar.xml.HandlerBasename - The attribute name.value - The attribute value.isSpecified - Unused.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||