public final class XmlHelper extends Object
Modifier and Type | Method and Description |
---|---|
static Iterator |
getChildrenByTagName(Element element,
String tagName)
Returns an iterator over the children of the given element with
the given tag name.
|
static String |
getElementContent(Element element)
Get the content of the given element.
|
static String |
getElementContent(Element element,
String defaultStr)
Get the content of the given element.
|
static Element |
getOptionalChild(Element element,
String tagName)
Gets the child of the specified element having the
specified name.
|
static Element |
getOptionalChild(Element element,
String tagName,
Element defaultElement)
Gets the child of the specified element having the
specified name.
|
static boolean |
getOptionalChildBooleanContent(Element element,
String name) |
static String |
getOptionalChildContent(Element element,
String tagName)
Macro to get the content of an optional child element.
|
static Element |
getUniqueChild(Element element,
String tagName)
Gets the child of the specified element having the specified unique
name.
|
static String |
getUniqueChildContent(Element element,
String tagName)
Macro to get the content of a unique child element.
|
public static Iterator getChildrenByTagName(Element element, String tagName)
element
- The parent elementtagName
- The name of the desired childpublic static Element getUniqueChild(Element element, String tagName) throws Exception
element
- The parent elementtagName
- The name of the desired childException
- Child was not found or was not unique.public static Element getOptionalChild(Element element, String tagName) throws Exception
element
- the parent elementtagName
- the name of the desired childException
public static Element getOptionalChild(Element element, String tagName, Element defaultElement) throws Exception
element
- the parent elementtagName
- the name of the desired childdefaultElement
- the element to return if the child
doesn't existException
public static String getElementContent(Element element) throws Exception
element
- The element to get the content for.Exception
public static String getElementContent(Element element, String defaultStr) throws Exception
element
- The element to get the content for.defaultStr
- The default to return when there is no content.Exception
public static String getUniqueChildContent(Element element, String tagName) throws Exception
element
- The parent element.tagName
- The name of the desired child.Exception
public static String getOptionalChildContent(Element element, String tagName) throws Exception
element
- The parent element.tagName
- The name of the desired child.Exception
Copyright © 2001-2017 Red Hat, Inc. All Rights Reserved.