public class CustomDocumentBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CLASSNAME |
(package private) static java.lang.String |
COPYRIGHT |
private static org.apache.log4j.Logger |
logger |
Modifier | Constructor and Description |
---|---|
private |
CustomDocumentBuilder()
Private ctor to prevent instatiation, this is a static class.
|
Modifier and Type | Method and Description |
---|---|
static org.dom4j.Document |
build(boolean validate,
java.io.File xml)
Creates an object representation of an XML file.
|
private static org.dom4j.Document |
build(boolean validate,
org.xml.sax.InputSource is)
Creates an object representation of an XML file.
|
static org.dom4j.Document |
build(boolean validate,
java.lang.String xml)
Creates an object representation of an XML file.
|
static org.dom4j.Document |
createShellDocument()
Creates a XML document containing an empty cXML tag.
|
static void |
dumpDocument(org.dom4j.Document theDoc)
Dumps the document contents to stdout.
|
static void |
dumpDocumentTwice(org.dom4j.Document theDoc)
Dumps the document contents to stdout, first without replacing HTML chars,
then replacing special HTML chars with built-ins.
|
static java.lang.String |
parseToString(org.dom4j.Document theDoc,
boolean isCompact,
boolean escapeHtmlChars)
Builds a String representation of the XML document.
|
private static java.lang.StringBuffer |
parseToStringBuffer(org.dom4j.Document theDoc,
boolean isCompact) |
private static void |
replaceInBuffer(java.lang.StringBuffer buffer,
java.lang.String charToReplace,
java.lang.String replacement) |
static final java.lang.String COPYRIGHT
private static final java.lang.String CLASSNAME
private static org.apache.log4j.Logger logger
private CustomDocumentBuilder()
public static org.dom4j.Document build(boolean validate, java.lang.String xml) throws B2bException
validate
- true to create a validating documentxml
- String which contains the XML contentB2bException
public static org.dom4j.Document build(boolean validate, java.io.File xml) throws B2bException
validate
- true to create a validating documentxml
- file which contains the XML contentB2bException
private static org.dom4j.Document build(boolean validate, org.xml.sax.InputSource is) throws B2bException
validate
- true to create a validating documentis
- Source which contains the XML contentB2bException
public static org.dom4j.Document createShellDocument() throws java.lang.Exception
java.lang.Exception
public static void dumpDocumentTwice(org.dom4j.Document theDoc)
theDoc
- to dumppublic static void dumpDocument(org.dom4j.Document theDoc)
theDoc
- to dumppublic static java.lang.String parseToString(org.dom4j.Document theDoc, boolean isCompact, boolean escapeHtmlChars) throws javax.xml.transform.TransformerException
theDoc
- XML document to parseisCompact
- true for a shorter representation (no indentation)escapeHtmlChars
- true if special HTML characters are replaced with
character entitiesjavax.xml.transform.TransformerException
- if an error occursprivate static void replaceInBuffer(java.lang.StringBuffer buffer, java.lang.String charToReplace, java.lang.String replacement)
buffer
- charToReplace
- replacement
- private static java.lang.StringBuffer parseToStringBuffer(org.dom4j.Document theDoc, boolean isCompact) throws javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerFactoryConfigurationError, javax.xml.transform.TransformerException
theDoc
- isCompact
- javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerFactoryConfigurationError
javax.xml.transform.TransformerException