|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 Map<String,String> |
namespaces
|
| Constructor Summary | |
|---|---|
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)
|
|
| Method Summary | |
|---|---|
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. |
| 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 Map<String,String> namespaces
| Constructor Detail |
|---|
public ToXMLContentHandler(OutputStream stream,
String encoding)
throws UnsupportedEncodingException
stream - output streamencoding - output encoding
UnsupportedEncodingException - if the encoding is unsupportedpublic ToXMLContentHandler(String encoding)
public ToXMLContentHandler()
| Method Detail |
|---|
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.DefaultHandlerSAXException
public void startElement(String uri,
String localName,
String qName,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerSAXException
public void endElement(String uri,
String localName,
String qName)
throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerSAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
ToTextContentHandler
characters in interface ContentHandlercharacters in class ToTextContentHandlerSAXException
protected void write(char ch)
throws SAXException
ch - character to be written
SAXException - if the character could not be written
protected void write(String string)
throws SAXException
string - string of character to be written
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 | |||||||||