|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler org.apache.tika.sax.ToTextContentHandler org.apache.tika.sax.ToXMLContentHandler
public class ToXMLContentHandler
SAX event handler that serializes the XML document to a character stream. The incoming SAX events are expected to be well-formed (properly nested, etc.) and to explicitly include namespace declaration attributes and corresponding namespace prefixes in element and attribute names.
Field Summary | |
---|---|
protected boolean |
inStartElement
|
protected java.util.Map<java.lang.String,java.lang.String> |
namespaces
|
Constructor Summary | |
---|---|
ToXMLContentHandler()
|
|
ToXMLContentHandler(java.io.OutputStream stream,
java.lang.String encoding)
Creates an XML serializer that writes to the given byte stream using the given character encoding. |
|
ToXMLContentHandler(java.lang.String encoding)
|
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
Writes the given characters to the given character stream. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
|
void |
startDocument()
Writes the XML prefix. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
|
protected void |
write(char ch)
Writes the given character as-is. |
protected void |
write(java.lang.String string)
Writes the given string of character as-is. |
Methods inherited from class org.apache.tika.sax.ToTextContentHandler |
---|
endDocument, ignorableWhitespace, toString |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean inStartElement
protected final java.util.Map<java.lang.String,java.lang.String> namespaces
Constructor Detail |
---|
public ToXMLContentHandler(java.io.OutputStream stream, java.lang.String encoding) throws java.io.UnsupportedEncodingException
stream
- output streamencoding
- output encoding
java.io.UnsupportedEncodingException
- if the encoding is unsupportedpublic ToXMLContentHandler(java.lang.String encoding)
public ToXMLContentHandler()
Method Detail |
---|
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
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
startPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void startElement(java.lang.String uri, 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
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
ToTextContentHandler
characters
in interface org.xml.sax.ContentHandler
characters
in class ToTextContentHandler
org.xml.sax.SAXException
protected void write(char ch) throws org.xml.sax.SAXException
ch
- character to be written
org.xml.sax.SAXException
- if the character could not be writtenprotected void write(java.lang.String string) throws org.xml.sax.SAXException
string
- string of character to be written
org.xml.sax.SAXException
- if the character string could not be written
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |