@OpenApiAll
public class XMLDataHandler
extends org.xml.sax.helpers.DefaultHandler
Modifier and Type | Field and Description |
---|---|
protected java.io.Writer |
writer
Contains writer for this handler.
|
Constructor and Description |
---|
XMLDataHandler(java.io.Writer writer)
Create SAX handler.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
/** Receive notification of character data inside an element.
|
void |
endDocument()
Receive notification of the end of the document.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Receive notification of the end of an element.
|
void |
startDocument()
Receive notification of the beginning of the document.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Receive notification of the start of an element.
|
protected void |
write(char c)
Write a single character.
|
protected void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
protected void |
write(java.lang.String string)
Write a string.
|
protected void |
write(java.lang.StringBuffer buffer)
Write a StringBuffer.
|
protected void |
writeAttributes(org.xml.sax.Attributes attributes)
Write all attributes to writer.
|
protected void |
writeText(char chr)
Filter the specified character that are sensitive to XML interpreters and write into the writer.
|
protected void |
writeText(char[] cbuf,
int off,
int len)
Filter the specified character that are sensitive to XML interpreters and write a portion of an array of
characters into the writer.
|
protected void |
writeText(java.lang.CharSequence buffer)
Filter the specified character that are sensitive to XML interpreters and write a StringBuffer into the
writer.
|
public XMLDataHandler(java.io.Writer writer)
writer
- output writerprotected void write(java.lang.String string) throws org.xml.sax.SAXException
string
- String to be writtenorg.xml.sax.SAXException
- If an I/O error occursprotected void write(java.lang.StringBuffer buffer) throws org.xml.sax.SAXException
buffer
- StringBuffer to be written.org.xml.sax.SAXException
- If an I/O error occursprotected void write(char c) throws org.xml.sax.SAXException
c
- int specifying a character to be written.org.xml.sax.SAXException
- If an I/O error occursprotected void write(char[] cbuf, int off, int len) throws org.xml.sax.SAXException
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writeorg.xml.sax.SAXException
- If an I/O error occursprotected void writeText(char chr) throws org.xml.sax.SAXException
chr
- int specifying a character to be written.org.xml.sax.SAXException
- If an I/O error occursprotected void writeText(char[] cbuf, int off, int len) throws org.xml.sax.SAXException
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writeorg.xml.sax.SAXException
- If an I/O error occursprotected void writeText(java.lang.CharSequence buffer) throws org.xml.sax.SAXException
buffer
- StringBufferorg.xml.sax.SAXException
- If an I/O error occursprotected void writeAttributes(org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
attributes
- XML attributesorg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void startDocument() throws org.xml.sax.SAXException
By default, write a XML document header.
startDocument
in interface org.xml.sax.ContentHandler
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
By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalizing a tree or closing an output file).
endDocument
in interface org.xml.sax.ContentHandler
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 uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
By default, write a XML start tag and attributes.
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace
processing is not being performed.localName
- 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.attributes
- 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 characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
By default, write a XML text content
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- The characters.start
- The start position in the character array.length
- The number of characters to use from the character array.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
By default, write a XML end tag
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace
processing is not being performed.localName
- 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.org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.Copyright © 2010 - No Magic Asia