|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.DefaultHandler | +--com.synex.xml.sax.XMLParser
The class reads XML documents according to specified DTD and translates all related events into XMLHandler events.
Usage sample:
XMLParser parser = new XMLParser(...); parser.parse(new InputSource("..."));
Constructor Summary | |
XMLParser()
Creates new XMLParser |
|
XMLParser(XMLHandler handler)
Creates new XML Parser |
Method Summary | |
void |
characters(char[] buf,
int offset,
int len)
Receive notification of character data. |
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document. |
void |
endCDATA()
Report the end of a CDATA section. |
void |
endDocument()
Receive notification of the end of the document. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String sName,
java.lang.String qName)
Receive notification of the end of an element. |
void |
endEntity(java.lang.String name)
Report the end of an entity. |
void |
ignorableWhitespace(char[] buf,
int offset,
int len)
Receive notification of ignorable whitespace in element content. |
static void |
main(java.lang.String[] argv)
The main method |
void |
parse(org.xml.sax.InputSource input)
The recognizer entry method taking an InputSource. |
void |
parse(org.xml.sax.InputSource input,
XMLHandler handler)
The recognizer entry method taking an Inputsource. |
void |
parse(java.net.URL url)
The recognizer entry method taking a URL. |
void |
parse(java.net.URL url,
XMLHandler handler)
The recognizer entry method taking a URL. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Receive notification of a processing instruction. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Receive a Locator object for document events. |
void |
setEcho(boolean pEcho)
Specifies that the parser will log the parser events to System.out |
void |
setNamespaceAware(boolean pNamespace)
Specifies that the parser will provide support for XML namespaces. |
void |
setValidating(boolean pValidating)
Specifies that the parser will validate documents as they are parsed. |
void |
startCDATA()
Report the start of a CDATA section. |
void |
startDocument()
Receive notification of the beginning of the document. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String sName,
java.lang.String qName,
org.xml.sax.Attributes attrs)
Receive notification of the start of an element. |
void |
startEntity(java.lang.String name)
Report the beginning of some internal and external XML entities. |
static void |
usage()
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endPrefixMapping, error, fatalError, notationDecl, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLParser()
public XMLParser(XMLHandler handler)
handler
- The SAX Handler to useMethod Detail |
public void setEcho(boolean pEcho)
pEcho
- True if the parser will log events; false otherwise.public void setValidating(boolean pValidating)
pValidating
- True if the parser will validate documents as they are parsed; false otherwise.public void setNamespaceAware(boolean pNamespace)
pNamespace
- True if the parser will provide support for XML namespaces; false otherwise.public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
locator
- A locator for all SAX document events.public void startDocument() throws org.xml.sax.SAXException
startDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void endDocument() throws org.xml.sax.SAXException
endDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void startElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
startElement
in class org.xml.sax.helpers.DefaultHandler
namespaceURI
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.sName
- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified name (with prefix), or the empty string if qualified names are not available.attrs
- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void endElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.helpers.DefaultHandler
namespaceURI
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.sName
- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void characters(char[] buf, int offset, int len) throws org.xml.sax.SAXException
characters
in class org.xml.sax.helpers.DefaultHandler
buf
- The characters from the XML document.offset
- The start position in the array.len
- The number of characters to read from the array.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void ignorableWhitespace(char[] buf, int offset, int len) throws org.xml.sax.SAXException
ignorableWhitespace
in class org.xml.sax.helpers.DefaultHandler
buf
- The characters from the XML document.offset
- The start position in the array.len
- The number of characters to read from the array.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in class org.xml.sax.helpers.DefaultHandler
target
- The processing instruction target.data
- The processing instruction data, or null if none was supplied. The data does not includeorg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity that is ending.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
name
- The document type name.publicId
- The declared public identifier for the external DTD subset, or null if none was declared.systemId
- The declared system identifier for the external DTD subset, or null if none was declared.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void parse(org.xml.sax.InputSource input) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
input
- InputSource to be parsed.java.io.IOException
- on I/O error.org.xml.sax.SAXException
- propagated exception thrown by a DocumentHandler.javax.xml.parsers.ParserConfigurationException
- a parser satisfining requested configuration can not be created.public void parse(java.net.URL url) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
url
- URL source to be parsed.java.io.IOException
- on I/O error.org.xml.sax.SAXException
- propagated exception thrown by a DocumentHandler.javax.xml.parsers.ParserConfigurationException
- a parser satisfining requested configuration can not be created.public void parse(org.xml.sax.InputSource input, XMLHandler handler) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
input
- InputSource to be parsed.handler
- The SAX XMLHandler to use.java.io.IOException
- on I/O error.org.xml.sax.SAXException
- propagated exception thrown by a DocumentHandler.javax.xml.parsers.ParserConfigurationException
- a parser satisfining requested configuration can not be created.public void parse(java.net.URL url, XMLHandler handler) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
url
- URL source to be parsed.handler
- The SAX XMLHandler to use.java.io.IOException
- on I/O error.org.xml.sax.SAXException
- propagated exception thrown by a DocumentHandler.javax.xml.parsers.ParserConfigurationException
- a parser satisfining requested configuration can not be created.public static void usage()
public static void main(java.lang.String[] argv)
argv
- the command line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2002 Sergey Yakovlev, All Rights Reserved.