public class XmlUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
OPTIONAL
XML component that is OPTIONAL.
|
static boolean |
REQUIRED
XML component that is REQUIRED.
|
Modifier and Type | Method and Description |
---|---|
static Node |
getChildNode(Node parentNode,
String childNodeName,
boolean optional)
For the specified parent node, gets the child node with
a specified name.
|
static List |
getChildNodes(Node parentNode,
String childNodeName,
boolean optional)
For the specified parent node, gets the child nodes with
a specified name.
|
static String |
getChildText(Node node)
Gets the text of the specified node.
|
static boolean |
getNodeBoolean(Node parentNode,
String childNodeName)
Gets a boolean value represented by the node text for the
specified required child of a parent node.
|
static boolean |
getNodeBoolean(Node parentNode,
String childNodeName,
boolean defaultValue)
Gets a boolean value represented by the node text for the
specified optional child of a parent node.
|
static String |
getNodeString(Node parentNode,
String childNodeName)
Gets the node text for the specified required child of a parent node.
|
static String |
getNodeString(Node parentNode,
String childNodeName,
String defaultValue)
Gets the node text for the specified optional child of a parent node.
|
public static boolean REQUIRED
public static boolean OPTIONAL
public static List getChildNodes(Node parentNode, String childNodeName, boolean optional)
If not optional
, an exception will be thrown
if there is no child node with the specified name.
parentNode
- the parent nodechildNodeName
- the child node name of interestoptional
- whether at least one child node is requiredpublic static Node getChildNode(Node parentNode, String childNodeName, boolean optional)
If there exists more than one child node with the specified
name, an exception will be thrown. On the other hand, if
not optional
, an exception will be thrown if
there is no child node with the specified name.
parentNode
- the parent nodechildNodeName
- the child node name of interestoptional
- whether the child node is optionalpublic static String getChildText(Node node)
node
- the nodepublic static String getNodeString(Node parentNode, String childNodeName, String defaultValue)
parentNode
- the parent nodechildNodeName
- the child node name of interestdefaultValue
- the default value if the node is not presentpublic static String getNodeString(Node parentNode, String childNodeName)
parentNode
- the parent nodechildNodeName
- the child node name of interestpublic static boolean getNodeBoolean(Node parentNode, String childNodeName, boolean defaultValue) throws IfsException
parentNode
- the parent nodechildNodeName
- the child node name of interestdefaultValue
- the default value if the node is not presentIfsException
- if the operation failspublic static boolean getNodeBoolean(Node parentNode, String childNodeName) throws IfsException
parentNode
- the parent nodechildNodeName
- the child node name of interestIfsException
- if the operation failsCopyright © 2023. All rights reserved.