|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.xml.parsers.DocumentBuilder
org.jdesktop.dom.SimpleHtmlDocumentBuilder
public class SimpleHtmlDocumentBuilder
An HTML DOM DocumentBuilder implementation that does
not require the factory pattern for creation. Most of the time calling one of
the static simpleParse methods is all that is required.
This implementation requires a normal DOM parser. It is not suitable for parsing arbitrary HTML documents, even those documents which conform to the various HTML specifications. Rather, it requires a preproccesor to first clean up the HTML such that it can be parsed into a DOM.
| Constructor Summary | |
|---|---|
SimpleHtmlDocumentBuilder()
Create a new SimpleHtmlDocumentBuilder. |
|
| Method Summary | |
|---|---|
DOMImplementation |
getDOMImplementation()
Obtain an instance of a DOMImplementation object. |
Schema |
getSchema()
Get a reference to the the Schema being used by
the XML processor. |
boolean |
isNamespaceAware()
Indicates whether or not this parser is configured to understand namespaces. |
boolean |
isValidating()
Indicates whether or not this parser is configured to validate XML documents. |
boolean |
isXIncludeAware()
Get the XInclude processing mode for this parser. |
SimpleHtmlDocument |
newDocument()
Obtain a new instance of a DOM Document object
to build a DOM tree with. |
SimpleHtmlDocument |
parse(File f)
Parse the content of the given file as an XML document and return a new DOM Document object. |
SimpleHtmlDocument |
parse(InputSource is)
Parse the content of the given input source as an XML document and return a new DOM Document object. |
SimpleHtmlDocument |
parse(InputStream is)
Parse the content of the given InputStream as an XML
document and return a new DOM Document object. |
SimpleHtmlDocument |
parse(InputStream is,
String systemId)
Parse the content of the given InputStream as an
XML document and return a new DOM Document object. |
SimpleHtmlDocument |
parse(String uri)
Parse the content of the given URI as an XML document and return a new DOM Document object. |
SimpleHtmlDocument |
parseString(String html)
Parse the content of the given String as an XML document and return a new HTML DOM SimpleHtmlDocument object. |
void |
reset()
Reset this DocumentBuilder to its original configuration. |
void |
setEntityResolver(EntityResolver er)
Specify the EntityResolver to be used to resolve
entities present in the XML document to be parsed. |
void |
setErrorHandler(ErrorHandler eh)
Specify the ErrorHandler to be used by the parser. |
static SimpleHtmlDocument |
simpleParse(InputSource is)
Parse the content of the given input source as an XML document and return a new HTML DOM SimpleDocument object. |
static SimpleHtmlDocument |
simpleParse(InputStream in)
Parse the content of the given InputStream as an XML
document and return a new HTML DOM SimpleHtmlDocument object. |
static SimpleHtmlDocument |
simpleParse(String xml)
Parse the content of the given String as an XML document and return a new HTML DOM SimpleHtmlDocument object. |
static SimpleHtmlDocument |
simpleParse(URL url)
Parse the content of the given URL as an XML document and return a new HTML DOM SimpleHtmlDocument object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleHtmlDocumentBuilder()
| Method Detail |
|---|
public SimpleHtmlDocument parseString(String html)
throws SAXException,
IOException
Parse the content of the given String as an XML
document and return a new HTML DOM SimpleHtmlDocument object.
An IllegalArgumentException is thrown if the
String is null.
NOTE: this implementation requires a normal DOM parser. It is not suitable for parsing arbitrary HTML documents, even those documents which conform to the various HTML specifications. Rather, it requires a preproccesor to first clean up the HTML such that it can be parsed into a DOM.
html - String containing the content to be parsed. Must be valid XHTML
SimpleHtmlDocument result of parsing the
String
IOException - If any IO errors occur.
SAXException - If any parse errors occur.
IllegalArgumentException - When html is nullDocumentHandler
public SimpleHtmlDocument parse(InputSource is)
throws SAXException,
IOException
javax.xml.parsers.DocumentBuilderDocument object.
An IllegalArgumentException is thrown if the
InputSource is null null.
parse in class DocumentBuilderis - InputSource containing the content to be parsed.
SAXException - If any parse errors occur.
IOException - If any IO errors occur.DocumentHandler
public SimpleHtmlDocument parse(InputStream is)
throws SAXException,
IOException
javax.xml.parsers.DocumentBuilderInputStream as an XML
document and return a new DOM Document object.
An IllegalArgumentException is thrown if the
InputStream is null.
parse in class DocumentBuilderis - InputStream containing the content to be parsed.
Document result of parsing the
InputStream
SAXException - If any parse errors occur.
IOException - If any IO errors occur.DocumentHandler
public SimpleHtmlDocument parse(InputStream is,
String systemId)
throws SAXException,
IOException
javax.xml.parsers.DocumentBuilderInputStream as an
XML document and return a new DOM Document object.
An IllegalArgumentException is thrown if the
InputStream is null.
parse in class DocumentBuilderis - InputStream containing the content to be parsed.systemId - Provide a base for resolving relative URIs.
SAXException - If any parse errors occur.
IOException - If any IO errors occur.DocumentHandler
public SimpleHtmlDocument parse(String uri)
throws SAXException,
IOException
javax.xml.parsers.DocumentBuilderDocument object.
An IllegalArgumentException is thrown if the
URI is null null.
parse in class DocumentBuilderuri - The location of the content to be parsed.
SAXException - If any parse errors occur.
IOException - If any IO errors occur.DocumentHandler
public SimpleHtmlDocument parse(File f)
throws SAXException,
IOException
javax.xml.parsers.DocumentBuilderDocument object.
An IllegalArgumentException is thrown if the
File is null null.
parse in class DocumentBuilderf - The file containing the XML to parse.
SAXException - If any parse errors occur.
IOException - If any IO errors occur.DocumentHandlerpublic boolean isNamespaceAware()
javax.xml.parsers.DocumentBuilder
isNamespaceAware in class DocumentBuilderpublic boolean isValidating()
javax.xml.parsers.DocumentBuilder
isValidating in class DocumentBuilderpublic void setEntityResolver(EntityResolver er)
javax.xml.parsers.DocumentBuilderEntityResolver to be used to resolve
entities present in the XML document to be parsed. Setting
this to null will result in the underlying
implementation using it's own default implementation and
behavior.
setEntityResolver in class DocumentBuilderer - The EntityResolver to be used to resolve entities
present in the XML document to be parsed.public void setErrorHandler(ErrorHandler eh)
javax.xml.parsers.DocumentBuilderErrorHandler to be used by the parser.
Setting this to null will result in the underlying
implementation using it's own default implementation and
behavior.
setErrorHandler in class DocumentBuildereh - The ErrorHandler to be used by the parser.public SimpleHtmlDocument newDocument()
javax.xml.parsers.DocumentBuilderDocument object
to build a DOM tree with.
newDocument in class DocumentBuilderpublic DOMImplementation getDOMImplementation()
javax.xml.parsers.DocumentBuilderDOMImplementation object.
getDOMImplementation in class DocumentBuilderDOMImplementation.public void reset()
javax.xml.parsers.DocumentBuilderReset this DocumentBuilder to its original configuration.
DocumentBuilder is reset to the same state as when it was created with
DocumentBuilderFactory.newDocumentBuilder().
reset() is designed to allow the reuse of existing DocumentBuilders
thus saving resources associated with the creation of new DocumentBuilders.
The reset DocumentBuilder is not guaranteed to have the same EntityResolver or ErrorHandler
Objects, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal
EntityResolver and ErrorHandler.
reset in class DocumentBuilderpublic Schema getSchema()
javax.xml.parsers.DocumentBuilderGet a reference to the the Schema being used by
the XML processor.
If no schema is being used, null is returned.
getSchema in class DocumentBuilderSchema being used or null
if none in usepublic boolean isXIncludeAware()
javax.xml.parsers.DocumentBuilderGet the XInclude processing mode for this parser.
isXIncludeAware in class DocumentBuilderDocumentBuilderFactory.isXIncludeAware()
when this parser was created from factory.DocumentBuilderFactory.setXIncludeAware(boolean)
public static SimpleHtmlDocument simpleParse(InputSource is)
throws SAXException,
IOException
Parse the content of the given input source as an XML document
and return a new HTML DOM SimpleDocument object.
An IllegalArgumentException is thrown if the
InputSource is null null.
NOTE: this implementation requires a normal DOM parser. It is not suitable for parsing arbitrary HTML documents, even those documents which conform to the various HTML specifications. Rather, it requires a preproccesor to first clean up the HTML such that it can be parsed into a DOM.
is - InputSource containing the content to be parsed.
IOException - If any IO errors occur.
SAXException - If any parse errors occur.
IllegalArgumentException - When is is nullDocumentHandler
public static SimpleHtmlDocument simpleParse(InputStream in)
throws SAXException,
IOException
Parse the content of the given InputStream as an XML
document and return a new HTML DOM SimpleHtmlDocument object.
An IllegalArgumentException is thrown if the
InputStream is null.
NOTE: this implementation requires a normal DOM parser. It is not suitable for parsing arbitrary HTML documents, even those documents which conform to the various HTML specifications. Rather, it requires a preproccesor to first clean up the HTML such that it can be parsed into a DOM.
is - InputStream containing the content to be parsed.
HtmlSimpleDocument result of parsing the
InputStream
IOException - If any IO errors occur.
SAXException - If any parse errors occur.
IllegalArgumentException - When is is nullDocumentHandler
public static SimpleHtmlDocument simpleParse(URL url)
throws SAXException,
IOException
Parse the content of the given URL as an XML document
and return a new HTML DOM SimpleHtmlDocument object.
An IllegalArgumentException is thrown if the
URI is null null.
NOTE: this implementation requires a normal DOM parser. It is not suitable for parsing arbitrary HTML documents, even those documents which conform to the various HTML specifications. Rather, it requires a preproccesor to first clean up the HTML such that it can be parsed into a DOM.
uri - The location of the content to be parsed.
IOException - If any IO errors occur.
SAXException - If any parse errors occur.
IllegalArgumentException - When url is nullDocumentHandler
public static SimpleHtmlDocument simpleParse(String xml)
throws SAXException,
IOException
Parse the content of the given String as an XML
document and return a new HTML DOM SimpleHtmlDocument object.
An IllegalArgumentException is thrown if the
String is null.
NOTE: this implementation requires a normal DOM parser. It is not suitable for parsing arbitrary HTML documents, even those documents which conform to the various HTML specifications. Rather, it requires a preproccesor to first clean up the HTML such that it can be parsed into a DOM.
xml - String containing the content to be parsed.
SimpleDocument result of parsing the
String
IOException - If any IO errors occur.
SAXException - If any parse errors occur.
IllegalArgumentException - When xml is nullDocumentHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||