public class Xmlwise
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.Document |
createDocument(java.lang.String xml)
Creates a DOM Document from the specified XML string, ignoring DTD-validation.
|
static org.w3c.dom.Document |
createDocument(java.lang.String xml,
boolean validate,
boolean loadExternalDTD)
Creates a DOM Document from the specified XML string, ignoring DTD-validation.
|
static XmlElement |
createXml(java.lang.String xml)
Creates a document from a string and transforms it into an XmlElement tree.
|
static java.lang.String |
escapeXML(java.lang.String stringToEscape)
Escapes a string to be used in an xml document.
|
static org.w3c.dom.Document |
loadDocument(java.io.File file)
Loads an XML document ignoring DTD-validation.
|
static org.w3c.dom.Document |
loadDocument(java.io.File file,
boolean validate,
boolean loadExternalDTD)
Loads an XML document.
|
static XmlElement |
loadXml(java.io.File file)
Loads a document from file and transforms it into an XmlElement tree.
|
static XmlElement |
loadXml(java.lang.String filename)
Loads a document from file and transforms it into an XmlElement tree.
|
public static org.w3c.dom.Document loadDocument(java.io.File file)
throws java.io.IOException,
XmlParseException
file - the file to read from.java.io.IOException - if we fail to load the file.XmlParseException - if there is a problem parsing the xml in the file.public static org.w3c.dom.Document loadDocument(java.io.File file,
boolean validate,
boolean loadExternalDTD)
throws java.io.IOException,
XmlParseException
file - the file to read from.validate - if we should validate the document or not.loadExternalDTD - true to allow loading of external dtds.java.io.IOException - if we fail to load the file.XmlParseException - if there is a problem parsing the xml in the file.public static org.w3c.dom.Document createDocument(java.lang.String xml,
boolean validate,
boolean loadExternalDTD)
throws XmlParseException
xml - a valid XML document, ie the String can't be null or emptyvalidate - if we should validate the document or not.loadExternalDTD - true to allow loading of external dtds.Document object for the specified string.XmlParseException - if we fail to parse the XML.public static org.w3c.dom.Document createDocument(java.lang.String xml)
throws XmlParseException
xml - a valid XML document, ie the String can't be null or emptyDocument object for the specified string.XmlParseException - if we fail to parse the XML.public static java.lang.String escapeXML(java.lang.String stringToEscape)
The following replacements are made:
| < | < |
| > | > |
| & | & |
| " | " |
| ' | ' |
stringToEscape - the string to escape.public static XmlElement loadXml(java.io.File file) throws XmlParseException, java.io.IOException
file - the file to load.XmlParseException - if parsing the file failed for some reason.java.io.IOException - if there were any problems reading from the file.public static XmlElement loadXml(java.lang.String filename) throws XmlParseException, java.io.IOException
filename - the path to the file.XmlParseException - if parsing the file failed for some reason.java.io.IOException - if there were any problems reading from the file.public static XmlElement createXml(java.lang.String xml) throws XmlParseException
xml - the xml as a string.XmlParseException - if parsing the xml failed to validate for some reason.