public class XmlUtil
extends java.lang.Object
Constructor and Description |
---|
XmlUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getNamespace(org.w3c.dom.Node node,
java.lang.String prefix)
Returns the namespace for the given prefix.
|
static org.w3c.dom.Node |
getNext(org.w3c.dom.Node node)
Get the next node in a depth first preorder traversal.
|
static java.lang.String |
getPIAttribute(java.lang.String pi,
java.lang.String key)
Extracts an attribute from a processing instruction.
|
static org.w3c.dom.Node |
getPrevious(org.w3c.dom.Node node)
Get the previous node in a DFS preorder traversal
|
static boolean |
isWhitespace(java.lang.String text)
Extracts the text value from the node.
|
static java.util.HashMap<java.lang.String,java.lang.String> |
splitNameList(java.lang.String name)
Treats the string as an attribute list, splitting it into a HashMap.
|
static void |
textValue(CharBuffer cb,
org.w3c.dom.Node node)
Extracts the text value from the node.
|
static java.lang.String |
textValue(org.w3c.dom.Node node)
Extracts the text value from the node.
|
static void |
toSAX(org.w3c.dom.Node node,
org.xml.sax.ContentHandler handler)
Sends data to the helper.
|
public static java.util.HashMap<java.lang.String,java.lang.String> splitNameList(java.lang.String name) throws java.io.IOException
name
- a string to be interpreted as an attribute listjava.io.IOException
public static java.lang.String getPIAttribute(java.lang.String pi, java.lang.String key)
<?xml-stylesheet href="default.xsl"?>
In the above example,
would return "default.xsl".getPIAttribute(node.getNodeValue(), "href")
pi
- the value of the processing instructionkey
- the attribute keypublic static org.w3c.dom.Node getNext(org.w3c.dom.Node node)
node
- the current nodepublic static org.w3c.dom.Node getPrevious(org.w3c.dom.Node node)
node
- the current nodepublic static java.lang.String textValue(org.w3c.dom.Node node)
public static void textValue(CharBuffer cb, org.w3c.dom.Node node)
public static boolean isWhitespace(java.lang.String text)
public static void toSAX(org.w3c.dom.Node node, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public static java.lang.String getNamespace(org.w3c.dom.Node node, java.lang.String prefix)