|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nu.staldal.xmltree.TreeBuilder
public class TreeBuilder
Build an XMLTree from a SAX2 event stream, or by parsing an XML document. The TreeBuilder ensures that the tree will not have two adjacent Text nodes.
Field Summary | |
---|---|
static boolean |
DEBUG
|
Constructor Summary | |
---|---|
TreeBuilder()
Constructs a TreeBuilder, ready to receive SAX events. |
|
TreeBuilder(java.net.URL base)
Constructs a TreeBuilder, ready to receive SAX events. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
endDocument()
|
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qname)
|
void |
endPrefixMapping(java.lang.String prefix)
|
void |
error(org.xml.sax.SAXParseException e)
|
void |
fatalError(org.xml.sax.SAXParseException e)
|
static org.xml.sax.InputSource |
fileToInputSource(java.io.File file)
Create an SAX InputSource from a File object. |
Element |
getTree()
Obtain the XTree built from SAX events. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
static Element |
parseXML(org.xml.sax.InputSource xmlInput,
boolean validateDTD)
Parse an XML document into an XTree. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
void |
skippedEntity(java.lang.String name)
|
void |
startDocument()
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qname,
org.xml.sax.Attributes atts)
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
|
void |
warning(org.xml.sax.SAXParseException e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean DEBUG
Constructor Detail |
---|
public TreeBuilder()
public TreeBuilder(java.net.URL base)
base
- base URL for the document, to support xml:base.Method Detail |
---|
public static org.xml.sax.InputSource fileToInputSource(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- the file
java.io.FileNotFoundException
- if the file doesn't exist
java.io.IOException
- if some I/O error occurspublic static Element parseXML(org.xml.sax.InputSource xmlInput, boolean validateDTD) throws org.xml.sax.SAXParseException, org.xml.sax.SAXException, java.io.IOException
xmlInput
- the input to parsevalidateDTD
- validate using DTD
org.xml.sax.SAXParseException
- if the XML data is not valid
org.xml.sax.SAXException
- if any other error occurs while parsing the XML data
java.io.IOException
- if there was some I/O error while reading the input.public Element getTree() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the SAX events received so far doesn't constitues a
well-formed XML document.public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qname) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXParseException
fatalError
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXParseException
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXParseException
error
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXParseException
public void warning(org.xml.sax.SAXParseException e)
warning
in interface org.xml.sax.ErrorHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |