public class ToXMLContentHandler extends ToTextContentHandler
Modifier and Type | Field and Description |
---|---|
protected boolean |
inStartElement |
protected Map<String,String> |
namespaces |
Constructor and Description |
---|
ToXMLContentHandler() |
ToXMLContentHandler(OutputStream stream,
String encoding)
Creates an XML serializer that writes to the given byte stream
using the given character encoding.
|
ToXMLContentHandler(String encoding) |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Writes the given characters to the given character stream.
|
void |
endElement(String uri,
String localName,
String qName) |
void |
startDocument()
Writes the XML prefix.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes atts) |
void |
startPrefixMapping(String prefix,
String uri) |
protected void |
write(char ch)
Writes the given character as-is.
|
protected void |
write(String string)
Writes the given string of character as-is.
|
endDocument, ignorableWhitespace, toString
endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning
public ToXMLContentHandler(OutputStream stream, String encoding) throws UnsupportedEncodingException
stream
- output streamencoding
- output encodingUnsupportedEncodingException
- if the encoding is unsupportedpublic ToXMLContentHandler(String encoding)
public ToXMLContentHandler()
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
ToTextContentHandler
characters
in interface ContentHandler
characters
in class ToTextContentHandler
SAXException
protected void write(char ch) throws SAXException
ch
- character to be writtenSAXException
- if the character could not be writtenprotected void write(String string) throws SAXException
string
- string of character to be writtenSAXException
- if the character string could not be writtenCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.