Package com.ibm.di.connector.maximo.util
Class Dom
- java.lang.Object
-
- com.ibm.di.connector.maximo.util.Dom
-
public final class Dom extends java.lang.Object
This class consists exclusively of static methods that operate on or return XML content and DOM elements.- Since:
- 7.1
-
-
Constructor Summary
Constructors Constructor Description Dom()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>
getAttributes(org.w3c.dom.Node rootNode)
Returns amap
containing the child nodes found in the given XML node.static java.util.Map<java.lang.String,java.lang.String>
getAttributes(org.w3c.dom.Node rootNode, java.util.Set<java.lang.String> names)
Searches the specified XML node for child nodes with the specified names.static java.lang.String
getAttributeValue(org.w3c.dom.Node node, java.lang.String attributeName)
Returns the value of the specified attribute.static org.w3c.dom.NodeList
getElements(java.lang.String elementName, java.lang.String xml)
Parses the XML content and returns all elements specified by elementName.static org.w3c.dom.NodeList
getElements(java.lang.String elementName, org.w3c.dom.Document document)
Returns all elements specified by elementName.static java.lang.String
getTextValue(org.w3c.dom.Node node)
Returns the text value of the specified XML node.static boolean
isNull(org.w3c.dom.Node node)
Indicates if the specified XML node hasnull
value.static org.w3c.dom.Document
parse(java.lang.String xml)
Parses the XML content.
-
-
-
Method Detail
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.String> getAttributes(org.w3c.dom.Node rootNode)
Returns amap
containing the child nodes found in the given XML node.- Parameters:
rootNode
- XML node whose child nodes are to be returned- Returns:
map
containing the child nodes found in the given XML node
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.String> getAttributes(org.w3c.dom.Node rootNode, java.util.Set<java.lang.String> names)
Searches the specified XML node for child nodes with the specified names.- Parameters:
rootNode
- XML node whose child nodes are to be returnednames
- names of the attributes to be found- Returns:
- a
map
containing the child nodes found and its respective values
-
getAttributeValue
public static java.lang.String getAttributeValue(org.w3c.dom.Node node, java.lang.String attributeName)
Returns the value of the specified attribute.- Parameters:
node
- node containing the specified attributeattributeName
- attribute's name- Returns:
- value of the specified attribute, or
null
if the attribute does not exist
-
getElements
public static org.w3c.dom.NodeList getElements(java.lang.String elementName, org.w3c.dom.Document document)
Returns all elements specified by elementName.- Parameters:
elementName
- name of the element to be returneddocument
- DOM document- Returns:
- a list of all elements found with the specified name s
-
getElements
public static org.w3c.dom.NodeList getElements(java.lang.String elementName, java.lang.String xml) throws MxConnXmlParsingException
Parses the XML content and returns all elements specified by elementName.- Parameters:
elementName
- name of the element to be returnedxml
- XML content to be parsed- Returns:
- a list of all elements found with the specified name
- Throws:
MxConnXmlParsingException
- if it is not possible to parse the XML content
-
getTextValue
public static java.lang.String getTextValue(org.w3c.dom.Node node)
Returns the text value of the specified XML node.- Parameters:
node
- XML node- Returns:
- text value of the specified XML node
-
isNull
public static boolean isNull(org.w3c.dom.Node node)
Indicates if the specified XML node hasnull
value. NOTE: Not used.- Parameters:
node
- XML node- Returns:
true
if the specified XML node hasnull
value, otherwisefalse
-
parse
public static org.w3c.dom.Document parse(java.lang.String xml) throws MxConnXmlParsingException
Parses the XML content.- Parameters:
xml
- XML content to be parsed- Returns:
- a DOM document
- Throws:
MxConnXmlParsingException
- if it is not possible to parse the XML content
-
-