Package org.apache.sling.commons.html
Interface HtmlParser
public interface HtmlParser
The HTML parser is a service to parse HTML and generate
SAX events or a Document out of the HTML.
-
Method Summary
Modifier and TypeMethodDescriptionvoidparse(InputStream inputStream, String encoding, ContentHandler contentHandler) Parse HTML and send SAX events.parse(String systemId, InputStream inputStream, String encoding) Parse HTML and return a DOM Document.
-
Method Details
-
parse
void parse(InputStream inputStream, String encoding, ContentHandler contentHandler) throws SAXException Parse HTML and send SAX events.- Parameters:
inputStream- The input streamencoding- Encoding of the input stream,nullfor default encoding.contentHandler- Content handler receiving the SAX events. The content handler might also implement the lexical handler interface.- Throws:
SAXException- Exception thrown when parsing fails.
-
parse
Parse HTML and return a DOM Document.- Parameters:
systemId- The system idinputStream- The input streamencoding- Encoding of the input stream,nullfor default encoding.- Returns:
- A DOM Document built from parsed HTML or
null - Throws:
IOException- Exception thrown when parsing fails.
-