|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.util.XMLUtilities
A class providing static utility methods for XML.
NOTE: This class currently reads XML documents only with the ISO-8859-1 encoding. This will change in the near future, after extended testing.
| Constructor Summary | |
XMLUtilities()
|
|
| Method Summary | |
protected static java.lang.String |
convert(java.lang.String str)
Replaces all unicode entities "...;" by a space. |
static java.lang.String |
extract(org.w3c.dom.Document document,
java.lang.String xpath)
Returns the value of the first node matching the specified XPATH expression. |
static java.lang.String |
extract(org.w3c.dom.Element element,
java.lang.String xpath)
Returns the value of the first node matching the specified XPATH expression. |
static void |
extract(org.w3c.dom.Element element,
java.lang.StringBuffer buffer)
Copies the text subnodes into the specified string buffer and appends two empty lines. |
static double |
extractDouble(org.w3c.dom.Document document,
java.lang.String xpath)
Returns the value of the first node matching the specified XPATH expression. |
static double |
extractDouble(org.w3c.dom.Element element,
java.lang.String xpath)
Returns the value of the first node matching the specified XPATH expression. |
static int |
extractInt(org.w3c.dom.Document document,
java.lang.String xpath)
Returns the value of the first node matching the specified XPATH expression. |
static int |
extractInt(org.w3c.dom.Element element,
java.lang.String xpath)
Returns the value of the first node matching the specified XPATH expression. |
static java.lang.String |
getDefaultEncoding()
Returns the default encoding. |
static org.w3c.dom.Element |
getXHTML(java.io.InputStream source)
Downloads an HTML file and converts it to XHTML. |
static org.w3c.dom.Element |
getXHTML(java.lang.String url)
Downloads a document given by the URL and converts it to XHTML. |
static org.w3c.dom.Element |
getXHTML(java.net.URL url)
Downloads a document given by the URLand converts it to XHTML. |
static java.lang.String |
getXPath(org.w3c.dom.Node node)
Returns a unique XPath expression (like /foo[1]/bar[42]) for the given node. |
static boolean |
isNamespaceAware()
Returns whether the parser is aware of namespaces. |
static org.w3c.dom.Document |
parse(java.io.File file)
Parses an XML file (default encoding) and returns a DOM document node. |
static org.w3c.dom.Document |
parse(java.io.File file,
java.lang.String encoding)
Parses an XML file and returns a DOM document node. |
static org.w3c.dom.Document |
parse(java.io.Reader reader)
Parses an XML file and returns a DOM document node. |
static org.w3c.dom.Document |
parse(java.lang.String filename)
Parses an XML file (default encoding) and returns a DOM document node. |
static org.w3c.dom.Document |
parse(java.lang.String filename,
java.lang.String encoding)
Parses an XML file and returns a DOM document node. |
static org.w3c.dom.Document |
parse(java.net.URL url)
Parses an XML file (default encoding) and returns a DOM document node. |
static org.w3c.dom.Document |
parse(java.net.URL url,
java.lang.String encoding)
Parses an XML file and returns a DOM document node. |
static org.w3c.dom.Document |
parseText(java.lang.String text)
Parses an XML string and returns a DOM document node. |
static void |
setDefaultEncoding(java.lang.String encoding)
Sets the default encoding. |
static void |
setNamespaceAware(boolean namespaceAware)
Sets whether the parser is aware of namespaces. |
static java.lang.String |
toString(org.w3c.dom.Document doc)
Returns a string representation of the complete XML tree, properly formatted. |
static java.lang.String |
toString(org.w3c.dom.Element element)
Returns a string representation of the complete XML tree, properly formatted. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XMLUtilities()
| Method Detail |
public static org.w3c.dom.Document parse(java.net.URL url)
url - URL of the XML file
public static org.w3c.dom.Document parse(java.net.URL url,
java.lang.String encoding)
url - URL of the XML fileencoding - file encoding
public static org.w3c.dom.Document parse(java.lang.String filename)
filename - name of the XML file
public static org.w3c.dom.Document parse(java.lang.String filename,
java.lang.String encoding)
filename - name of the XML fileencoding - file encoding
public static org.w3c.dom.Document parse(java.io.File file)
file - XML file
public static org.w3c.dom.Document parse(java.io.File file,
java.lang.String encoding)
file - XML fileencoding - file encoding
public static org.w3c.dom.Document parse(java.io.Reader reader)
reader - reader for the XML file
public static org.w3c.dom.Document parseText(java.lang.String text)
text - XML string
public static java.lang.String toString(org.w3c.dom.Element element)
element - XML tree
public static java.lang.String toString(org.w3c.dom.Document doc)
doc - XML tree
public static org.w3c.dom.Element getXHTML(java.lang.String url)
url - URL of the document
public static org.w3c.dom.Element getXHTML(java.net.URL url)
url - URL of the document
public static org.w3c.dom.Element getXHTML(java.io.InputStream source)
source - HTML source stream
protected static java.lang.String convert(java.lang.String str)
str - string to convert
public static java.lang.String extract(org.w3c.dom.Document document,
java.lang.String xpath)
document - XML document from which the search should startxpath - XPATH expression
public static java.lang.String extract(org.w3c.dom.Element element,
java.lang.String xpath)
element - XML element from which the search should startxpath - XPATH expression
public static double extractDouble(org.w3c.dom.Document document,
java.lang.String xpath)
document - XML document from which the search should startxpath - XPATH expression
public static double extractDouble(org.w3c.dom.Element element,
java.lang.String xpath)
element - XML element from which the search should startxpath - XPATH expression
public static int extractInt(org.w3c.dom.Document document,
java.lang.String xpath)
document - XML document from which the search should startxpath - XPATH expression
public static int extractInt(org.w3c.dom.Element element,
java.lang.String xpath)
element - XML element from which the search should startxpath - XPATH expression
public static void extract(org.w3c.dom.Element element,
java.lang.StringBuffer buffer)
element - XML element whose text subnodes have to be addedbuffer - string buffer for the resultpublic static java.lang.String getDefaultEncoding()
public static void setDefaultEncoding(java.lang.String encoding)
encoding - default encodingpublic static java.lang.String getXPath(org.w3c.dom.Node node)
node - XML node
public static boolean isNamespaceAware()
public static void setNamespaceAware(boolean namespaceAware)
namespaceAware - is true, the parser cares about namespaces
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||