Package org.apache.tika.sax
Class ToXMLContentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.tika.sax.ToTextContentHandler
org.apache.tika.sax.ToXMLContentHandler
- All Implemented Interfaces:
- ContentHandler,- DTDHandler,- EntityResolver,- ErrorHandler
- Direct Known Subclasses:
- ToHTMLContentHandler
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.
- Since:
- Apache Tika 0.10
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected boolean
- 
Constructor SummaryConstructorsConstructorDescriptionToXMLContentHandler(OutputStream stream, String encoding) Creates an XML serializer that writes to the given byte stream using the given character encoding.ToXMLContentHandler(String encoding) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Writes the given characters to the given character stream.voidendElement(String uri, String localName, String qName) voidWrites the XML prefix.voidstartElement(String uri, String localName, String qName, Attributes atts) voidstartPrefixMapping(String prefix, String uri) protected voidwrite(char ch) Writes the given character as-is.protected voidWrites the given string of character as-is.Methods inherited from class org.apache.tika.sax.ToTextContentHandlerendDocument, ignorableWhitespace, toStringMethods inherited from class org.xml.sax.helpers.DefaultHandlerendPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warningMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandlerdeclaration
- 
Field Details- 
namespaces
- 
inStartElementprotected boolean inStartElement
 
- 
- 
Constructor Details- 
ToXMLContentHandlerpublic ToXMLContentHandler(OutputStream stream, String encoding) throws UnsupportedEncodingException Creates an XML serializer that writes to the given byte stream using the given character encoding.- Parameters:
- stream- output stream
- encoding- output encoding
- Throws:
- UnsupportedEncodingException- if the encoding is unsupported
 
- 
ToXMLContentHandler
- 
ToXMLContentHandlerpublic ToXMLContentHandler()
 
- 
- 
Method Details- 
startDocumentWrites the XML prefix.- Specified by:
- startDocumentin interface- ContentHandler
- Overrides:
- startDocumentin class- DefaultHandler
- Throws:
- SAXException
 
- 
startPrefixMapping- Specified by:
- startPrefixMappingin interface- ContentHandler
- Overrides:
- startPrefixMappingin class- DefaultHandler
- Throws:
- SAXException
 
- 
startElementpublic void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException - Specified by:
- startElementin interface- ContentHandler
- Overrides:
- startElementin class- ToTextContentHandler
- Throws:
- SAXException
 
- 
endElement- Specified by:
- endElementin interface- ContentHandler
- Overrides:
- endElementin class- ToTextContentHandler
- Throws:
- SAXException
 
- 
charactersDescription copied from class:ToTextContentHandlerWrites the given characters to the given character stream.- Specified by:
- charactersin interface- ContentHandler
- Overrides:
- charactersin class- ToTextContentHandler
- Throws:
- SAXException
 
- 
writeWrites the given character as-is.- Parameters:
- ch- character to be written
- Throws:
- SAXException- if the character could not be written
 
- 
writeWrites the given string of character as-is.- Parameters:
- string- string of character to be written
- Throws:
- SAXException- if the character string could not be written
 
 
-