Package org.faktorips.runtime.internal
Enum XmlUtil
- java.lang.Object
-
- java.lang.Enum<XmlUtil>
-
- org.faktorips.runtime.internal.XmlUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<org.w3c.dom.Element>findFirstElement(org.w3c.dom.Node parent)Returns the first Element nodestatic java.util.Optional<org.w3c.dom.Element>findFirstElement(org.w3c.dom.Node parent, java.lang.String tagName)static java.lang.StringgetCDATAorTextContent(org.w3c.dom.Node node)Returns the node's first CDATA section if the node has one.static org.w3c.dom.ElementgetElement(org.w3c.dom.Node parent, java.lang.String tagName, int index)Returns the child element with the given tag name and index.static java.util.List<org.w3c.dom.Element>getElements(org.w3c.dom.Node parent, java.lang.String tagName)Returns all child elements with the given tag name.static java.util.List<org.w3c.dom.Element>getElementsFromNode(org.w3c.dom.Element elem, java.lang.String nodeName, java.lang.String attributeName, java.lang.String attributeValue)Returns a list of element's with the following criteria: the node name must be equal to the given node name the node must contain an attribute with the attribute name the value of the attribute (with the given name) must be equal to the given valuestatic org.w3c.dom.CDATASectiongetFirstCDataSection(org.w3c.dom.Node node)Returns the node's first CDATA section ornullif the node hasn't got one.static org.w3c.dom.ElementgetFirstElement(org.w3c.dom.Node parent)Returns the first Element nodestatic org.w3c.dom.ElementgetFirstElement(org.w3c.dom.Node parent, java.lang.String tagName)static org.w3c.dom.TextgetTextNode(org.w3c.dom.Node node)Returns the node's text child node ornullif the node hasn't got a text node.static java.lang.StringgetValueFromNode(org.w3c.dom.Element elem, java.lang.String nodeName)Returns the value of the first element with the given node name, starts searching by the given Elementstatic XmlUtilvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static XmlUtil[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static XmlUtil[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (XmlUtil c : XmlUtil.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static XmlUtil valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getFirstElement
public static final org.w3c.dom.Element getFirstElement(org.w3c.dom.Node parent, java.lang.String tagName)
-
findFirstElement
public static final java.util.Optional<org.w3c.dom.Element> findFirstElement(org.w3c.dom.Node parent, java.lang.String tagName)
-
getFirstElement
public static final org.w3c.dom.Element getFirstElement(org.w3c.dom.Node parent)
Returns the first Element node
-
findFirstElement
public static final java.util.Optional<org.w3c.dom.Element> findFirstElement(org.w3c.dom.Node parent)
Returns the first Element node
-
getElement
public static final org.w3c.dom.Element getElement(org.w3c.dom.Node parent, java.lang.String tagName, int index)Returns the child element with the given tag name and index. The index is the position of the element considering all child elements with the given tag name.- Parameters:
parent- The parent node.tagName- the element tag name.index- The 0 based position of the child.- Returns:
- The element at the specified index
- Throws:
java.lang.IndexOutOfBoundsException- if no element exists at the specified index.
-
getElements
public static final java.util.List<org.w3c.dom.Element> getElements(org.w3c.dom.Node parent, java.lang.String tagName)Returns all child elements with the given tag name. Considers only direct children. UseElement.getElementsByTagName(String)to search all descendants.- Parameters:
parent- The parent node.tagName- the element tag name.- Returns:
- all child elements with the matching tag name
-
getTextNode
public static final org.w3c.dom.Text getTextNode(org.w3c.dom.Node node)
Returns the node's text child node ornullif the node hasn't got a text node.
-
getFirstCDataSection
public static final org.w3c.dom.CDATASection getFirstCDataSection(org.w3c.dom.Node node)
Returns the node's first CDATA section ornullif the node hasn't got one.
-
getCDATAorTextContent
public static final java.lang.String getCDATAorTextContent(org.w3c.dom.Node node)
Returns the node's first CDATA section if the node has one. If not, this returns the node's text child node ornullif the node hasn't got a text node.
-
getValueFromNode
public static final java.lang.String getValueFromNode(org.w3c.dom.Element elem, java.lang.String nodeName)Returns the value of the first element with the given node name, starts searching by the given Element- Parameters:
elem- The first element (root or parent) element the search beginsnodeName- The name searching for
-
getElementsFromNode
public static final java.util.List<org.w3c.dom.Element> getElementsFromNode(org.w3c.dom.Element elem, java.lang.String nodeName, java.lang.String attributeName, java.lang.String attributeValue)Returns a list of element's with the following criteria:- the node name must be equal to the given node name
- the node must contain an attribute with the attribute name
- the value of the attribute (with the given name) must be equal to the given value
-
-