Class Xml2TextHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.nuxeo.ecm.core.convert.plugins.text.extractors.Xml2TextHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class Xml2TextHandler extends DefaultHandler
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected StringBuilder
builder
protected static SAXParserFactory
factory
protected SAXParser
parser
protected boolean
trim
-
Constructor Summary
Constructors Constructor Description Xml2TextHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endElement(String uri, String localName, String name)
SAXParser
getParser()
String
getText()
String
parse(File file)
String
parse(InputStream in)
String
parse(InputSource is)
void
startDocument()
void
startElement(String uri, String localName, String name, Attributes attributes)
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
factory
protected static final SAXParserFactory factory
-
builder
protected StringBuilder builder
-
trim
protected boolean trim
-
-
Constructor Detail
-
Xml2TextHandler
public Xml2TextHandler() throws SAXException, ParserConfigurationException
-
-
Method Detail
-
parse
public String parse(File file) throws SAXException, IOException
- Throws:
SAXException
IOException
-
parse
public String parse(InputStream in) throws SAXException, IOException
- Throws:
SAXException
IOException
-
parse
public String parse(InputSource is) throws SAXException, IOException
- Throws:
SAXException
IOException
-
startDocument
public void startDocument() throws SAXException
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classDefaultHandler
- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String name) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
-