Package org.apache.tika.sax
Class ToMarkdownContentHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.tika.sax.ToMarkdownContentHandler
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
public class ToMarkdownContentHandler extends DefaultHandler
SAX event handler that writes content as Markdown. Supports headings, paragraphs, bold, italic, links, images, lists (ordered and unordered, including nested), tables (GFM pipe tables), code blocks, inline code, blockquotes, horizontal rules, and definition lists.Content within <script> and <style> tags is ignored.
- Since:
- Apache Tika 3.2
-
-
Constructor Summary
Constructors Constructor Description ToMarkdownContentHandler()ToMarkdownContentHandler(OutputStream stream, String encoding)ToMarkdownContentHandler(Writer writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)voidendDocument()voidendElement(String uri, String localName, String qName)voidignorableWhitespace(char[] ch, int start, int length)voidstartElement(String uri, String localName, String qName, Attributes atts)StringtoString()-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
ToMarkdownContentHandler
public ToMarkdownContentHandler(Writer writer)
-
ToMarkdownContentHandler
public ToMarkdownContentHandler(OutputStream stream, String encoding) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
ToMarkdownContentHandler
public ToMarkdownContentHandler()
-
-
Method Detail
-
startElement
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
-