Package io.github.microcks.util
Class XmlUtil
java.lang.Object
io.github.microcks.util.XmlUtil
Helper methods for parsing/navigating an Xml DOM.
- Author:
- laurent
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetDirectChildren
(Element parent, String namespace, String tag) Retrieve direct children elements of a parent having specified namespace and tag.static Element
getUniqueDirectChild
(Element parent, String namespace, String tag) Retrieve a direct child that is expected to be unique under the parent.static boolean
hasDirectChild
(Element parent, String namespace, String tag) Check if parent has at least one direct child having namespace and tag.
-
Field Details
-
XML_SCHEMA_NS
XML Schema public namespace;- See Also:
-
WSDL_NS
WSDL public namespace.- See Also:
-
-
Method Details
-
getDirectChildren
Retrieve direct children elements of a parent having specified namespace and tag. Only includes level 1 children.- Parameters:
parent
- The parent of children to findnamespace
- The namespace of childrentag
- The tag of children- Returns:
- Children Elements as a list
-
getUniqueDirectChild
public static Element getUniqueDirectChild(Element parent, String namespace, String tag) throws MalformedXmlException Retrieve a direct child that is expected to be unique under the parent. Throws a MalformedXmlException if no child or more than one child present.- Parameters:
parent
- The parent of child to findnamespace
- The namespace of childtag
- The tag of child- Returns:
- The child Element
- Throws:
MalformedXmlException
- if no child or more than one child present.
-
hasDirectChild
Check if parent has at least one direct child having namespace and tag.- Parameters:
parent
- The parent of children to findnamespace
- The namespace of childrentag
- The tag of children- Returns:
- true if at least one child is present, false otherwise
-