public class XmlUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static javax.xml.parsers.DocumentBuilderFactory |
dbFact_ |
private static java.util.logging.Logger |
logger_ |
Modifier | Constructor and Description |
---|---|
private |
XmlUtils()
Private constructor prevents instantiation.
|
Modifier and Type | Method and Description |
---|---|
(package private) static javax.xml.parsers.DocumentBuilder |
createDocumentBuilder()
Returns a new DocumentBuilder with default characteristics.
|
static org.w3c.dom.Element |
getChild(org.w3c.dom.Node parent)
Returns the single element child of a DOM node.
|
static org.w3c.dom.Element |
getChild(org.w3c.dom.Node parent,
java.lang.String tagName)
Returns the single child element of a DOM node, which has a given
known name.
|
static org.w3c.dom.Element[] |
getChildren(org.w3c.dom.Node parent)
Returns an array of all the Element children of a DOM node.
|
static java.lang.String |
getTextContent(org.w3c.dom.Element el)
Returns the text content of an element as a string.
|
static java.lang.Object |
parseSampValue(org.w3c.dom.Element valueEl)
Returns the content of a DOM element representing a
value
element of an XML-RPC document. |
private static java.util.logging.Logger logger_
private static javax.xml.parsers.DocumentBuilderFactory dbFact_
public static org.w3c.dom.Element[] getChildren(org.w3c.dom.Node parent)
parent
- parent nodepublic static org.w3c.dom.Element getChild(org.w3c.dom.Node parent) throws XmlRpcFormatException
parent
- parent nodeXmlRpcFormatException
- if there is not exactly one child
per elementpublic static org.w3c.dom.Element getChild(org.w3c.dom.Node parent, java.lang.String tagName) throws XmlRpcFormatException
parent
- parent nodetagName
- child node nametagName
XmlRpcFormatException
- if there is not exactly one child
element or if it does not have name tagName
public static java.lang.String getTextContent(org.w3c.dom.Element el) throws XmlRpcFormatException
el
- parent nodeXmlRpcFormatException
- if content is not just textpublic static java.lang.Object parseSampValue(org.w3c.dom.Element valueEl) throws XmlRpcFormatException
value
element of an XML-RPC document.
Note that some content which would be legal in XML-RPC, but is not
legal in SAMP, may result in an exception.valueEl
- value elementXmlRpcFormatException
static javax.xml.parsers.DocumentBuilder createDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException