This class provides a few utility methods for dealing with XML/XPath.
makeDocument
public static Document makeDocument(InputStream stream,
boolean validate,
boolean whitespace,
boolean namespace,
boolean tolerant)
throws ParserConfigurationException,
SAXException,
IOException,
TidyException
Utility function to get new Document
stream
- Document Input streamvalidate
- Validate Document (not Tidy)whitespace
- Element Whitespace (not Tidy)namespace
- Is Namespace aware.tolerant
- Is tolerant - i.e. use the Tidy parser
makeDocument
public static Document makeDocument(InputStream stream,
boolean validate,
boolean whitespace,
boolean namespace,
boolean tolerant,
boolean quiet,
boolean showWarnings,
boolean report_errors)
throws ParserConfigurationException,
SAXException,
IOException,
TidyException
Utility function to get new Document
stream
- - Document Input streamvalidate
- - Validate Document (not Tidy)whitespace
- - Element Whitespace (not Tidy)namespace
- - Is Namespace aware. (not Tidy)tolerant
- - Is tolerant - i.e. use the Tidy parserquiet
- - set Tidy quietshowWarnings
- - set Tidy warningsreport_errors
- - throw TidyException if Tidy detects an error
makeDocument
public static Document makeDocument(InputStream stream,
boolean validate,
boolean whitespace,
boolean namespace,
boolean tolerant,
boolean quiet,
boolean showWarnings,
boolean report_errors,
boolean isXml)
throws ParserConfigurationException,
SAXException,
IOException,
TidyException
Utility function to get new Document
stream
- - Document Input streamvalidate
- - Validate Document (not Tidy)whitespace
- - Element Whitespace (not Tidy)namespace
- - Is Namespace aware. (not Tidy)tolerant
- - Is tolerant - i.e. use the Tidy parserquiet
- - set Tidy quietshowWarnings
- - set Tidy warningsreport_errors
- - throw TidyException if Tidy detects an errorisXml
- - is document already XML (Tidy only)
makeDocumentBuilder
public static DocumentBuilder makeDocumentBuilder(boolean validate,
boolean whitespace,
boolean namespace)
throws ParserConfigurationException
Create a DocumentBuilder using the makeDocumentFactory func.
validate
- should the parser validate documents?whitespace
- should the parser eliminate whitespace in element content?namespace
- should the parser be namespace aware?
makeTidyParser
public static Tidy makeTidyParser(boolean quiet,
boolean showWarnings,
boolean isXml,
StringWriter stringWriter)
Create a Tidy parser with the specified settings.
quiet
- - set the Tidy quiet flag?showWarnings
- - show Tidy warnings?isXml
- - treat the content as XML?stringWriter
- - if non-null, use this for Tidy errorOutput