| java.lang.Object de.nava.informa.utils.XmlPathUtils
XmlPathUtils | public class XmlPathUtils (Code) | | Utility class providing methods access XML attributes and elements using
a path.
author: Michael Harhen |
Method Summary | |
public static String | getAttributeValue(Element parent, String childPath, String attribute) Returns the value of the attribute of the child element reached by the
given path. | public static String[] | getAttributeValues(Element parent, String childPath, String[] attributes) Returns the value of the child element reached by the given path.
This is useful in cases where a child has several attributes.
Traverses the DOM tree from the parent until the child is reached.
Parameters: parent - the parent Element Parameters: childPath - a path to the root of the elements. | public static String[] | getAttributeValues(Element element, String[] attributes) Returns the values of the attributes of given element.
This is useful in cases where an element has several attributes.
Parameters: element - the Element Parameters: attributes - An array of attribute names.May contain namespace specifiers. | public static String | getElementValue(Element parent, String childPath) Returns the value of an element's child element reached by the given path.
Traverses the DOM tree from the parent until the child is reached.
Parameters: parent - the parent Element Parameters: childPath - a path to the root of the elements.Paths are specified as element names, separated by a "/".Namespaces are allowed. | public static String[] | getElementValues(Element parent, String childPath, String[] elements) Returns the values of the specified sub-elements of the child element
reached by the given path. | public static String[] | getElementValues(Element parent, String[] children) Returns the values of the specified sub-elements of the child parent element.
This is useful in cases where an element has several children.
Parameters: parent - the parent Element Parameters: children - An array of child element names. |
getAttributeValue | public static String getAttributeValue(Element parent, String childPath, String attribute)(Code) | | Returns the value of the attribute of the child element reached by the
given path. Traverses the DOM tree from the parent until the child is
reached, then reads the given attribute.
Parameters: parent - the parent Element Parameters: childPath - a path to the root of the elements.Paths are specified as element names, separated by a "/". Parameters: attribute - the attribute.May contain a namespace specifier e.g. "rdf:resource". the value of the attribute. If parent or attribute isnull , returns null .If childPath is null, returns the specifiedattribute of the parent. |
getAttributeValues | public static String[] getAttributeValues(Element parent, String childPath, String[] attributes)(Code) | | Returns the value of the child element reached by the given path.
This is useful in cases where a child has several attributes.
Traverses the DOM tree from the parent until the child is reached.
Parameters: parent - the parent Element Parameters: childPath - a path to the root of the elements. Paths are specifiedas element names, separated by a "/". Namespaces are allowed.e.g. "aaa:bbb/ccc:ddd/eee". Parameters: attributes - - An array of element names. May contain namespacespecifiers. the value of the child. If parent orattributes is null , returnsnull . If childPath is null, returnsthe specified attributes of the parent. |
getAttributeValues | public static String[] getAttributeValues(Element element, String[] attributes)(Code) | | Returns the values of the attributes of given element.
This is useful in cases where an element has several attributes.
Parameters: element - the Element Parameters: attributes - An array of attribute names.May contain namespace specifiers. an array containing the values of the element's attributes. If element or attributes is null , returns null . |
getElementValue | public static String getElementValue(Element parent, String childPath)(Code) | | Returns the value of an element's child element reached by the given path.
Traverses the DOM tree from the parent until the child is reached.
Parameters: parent - the parent Element Parameters: childPath - a path to the root of the elements.Paths are specified as element names, separated by a "/".Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee". the value of the child. If parent isnull , returns null . IfchildPath is null, returns the value of the parent. |
getElementValues | public static String[] getElementValues(Element parent, String childPath, String[] elements)(Code) | | Returns the values of the specified sub-elements of the child element
reached by the given path. This is useful in cases where a child has
several children. Traverses the DOM tree from the parent until the root
is reached, then reads the specified elements.
Parameters: parent - the parent Element Parameters: childPath - a path to the root of the elements.Paths are specified as element names, separated by a "/".Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee". Parameters: elements - An array of element names. May contain namespace specifiers. an array containing the value of each element. If parent or elements isnull , returns null . IfchildPath is null, returns the specified sub-elementsof the parent. |
getElementValues | public static String[] getElementValues(Element parent, String[] children)(Code) | | Returns the values of the specified sub-elements of the child parent element.
This is useful in cases where an element has several children.
Parameters: parent - the parent Element Parameters: children - An array of child element names. May contain namespace specifiers. an array containing the value of each child element. If parent or children is null , returns null . |
|
|