public final class DOMUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
copyAttributes(Element destElement,
Element srcElement)
Copy attributes between elements
|
static Element |
createElement(QName qname)
Create an Element for a given QName
|
static Element |
createElement(String localPart)
Create an Element for a given name
|
static Element |
createElement(String localPart,
String prefix)
Create an Element for a given name and prefix
|
static Element |
createElement(String localPart,
String prefix,
String uri)
Create an Element for a given name, prefix and uri
|
static Text |
createTextNode(String value)
Create a org.w3c.dom.Text node
|
static Map |
getAttributes(Element el) |
static String |
getAttributeValue(Element el,
QName attrName)
Get the value from the given attribute
|
static String |
getAttributeValue(Element el,
String attrName)
Get the value from the given attribute
|
static boolean |
getAttributeValueAsBoolean(Element el,
QName attrName) |
static boolean |
getAttributeValueAsBoolean(Element el,
String attrName) |
static Integer |
getAttributeValueAsInteger(Element el,
QName attrName) |
static Integer |
getAttributeValueAsInteger(Element el,
String attrName) |
static QName |
getAttributeValueAsQName(Element el,
QName attrName) |
static QName |
getAttributeValueAsQName(Element el,
String attrName) |
static Iterator |
getChildElements(Node node)
Gets child elements
|
static Iterator |
getChildElements(Node node,
QName nodeName)
Gets the child element for a given qname
|
static Iterator |
getChildElements(Node node,
String nodeName)
Gets the child elements for a given local name without namespace
|
static DocumentBuilder |
getDocumentBuilder() |
static QName |
getElementQName(Element el) |
static Element |
getFirstChildElement(Node node) |
static Element |
getFirstChildElement(Node node,
QName nodeName) |
static Element |
getFirstChildElement(Node node,
String nodeName) |
static Document |
getOwnerDocument() |
static Element |
getParentElement(Node node)
Gets parent element or null if there is none
|
static String |
getTextContent(Node node)
Get the concatenated text content, or null.
|
static String |
getTextContent(Node node,
boolean replaceProps)
Get the concatenated text content, or null.
|
static boolean |
hasChildElements(Node node)
True if the node has child elements
|
static Element |
parse(InputSource source)
Parse the given input source and return the root Element
|
static Element |
parse(InputStream xmlStream)
Parse the given XML stream and return the root Element
|
static Element |
parse(String xmlString)
Parse the given XML string and return the root Element
|
static QName |
resolveQName(Element el,
String qualifiedName)
Transform the giveen qualified name into a QName
|
public static DocumentBuilder getDocumentBuilder()
public static Element parse(String xmlString) throws IOException
xmlString
- IOException
public static Element parse(InputStream xmlStream) throws IOException
xmlStream
- IOException
public static Element parse(InputSource source) throws IOException
source
- IOException
public static Element createElement(String localPart)
localPart
- public static Element createElement(String localPart, String prefix)
localPart
- prefix
- public static Element createElement(String localPart, String prefix, String uri)
localPart
- prefix
- uri
- public static Element createElement(QName qname)
qname
- public static Text createTextNode(String value)
value
- public static QName getElementQName(Element el)
el
- public static QName resolveQName(Element el, String qualifiedName)
el
- qualifiedName
- public static String getAttributeValue(Element el, String attrName)
el
- attrName
- public static String getAttributeValue(Element el, QName attrName)
el
- attrName
- public static QName getAttributeValueAsQName(Element el, String attrName)
el
- attrName
- public static QName getAttributeValueAsQName(Element el, QName attrName)
el
- attrName
- public static boolean getAttributeValueAsBoolean(Element el, String attrName)
el
- attrName
- public static boolean getAttributeValueAsBoolean(Element el, QName attrName)
el
- attrName
- public static Integer getAttributeValueAsInteger(Element el, String attrName)
el
- attrName
- public static Integer getAttributeValueAsInteger(Element el, QName attrName)
el
- attrName
- public static Map getAttributes(Element el)
el
- public static void copyAttributes(Element destElement, Element srcElement)
destElement
- srcElement
- public static boolean hasChildElements(Node node)
node
- public static Iterator getChildElements(Node node)
node
- public static String getTextContent(Node node)
node
- public static String getTextContent(Node node, boolean replaceProps)
node
- node to search for TEXT_NODE conentreplaceProps
- flag indicating if ${x} property refs should be replacepublic static Element getFirstChildElement(Node node)
node
- public static Element getFirstChildElement(Node node, String nodeName)
node
- nodeName
- public static Element getFirstChildElement(Node node, QName nodeName)
node
- nodeName
- public static Iterator getChildElements(Node node, String nodeName)
node
- nodeName
- public static Iterator getChildElements(Node node, QName nodeName)
node
- nodeName
- public static Element getParentElement(Node node)
node
- public static Document getOwnerDocument()
Copyright © 2018 JBoss by Red Hat. All rights reserved.