public class XmlHelper
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
XmlHelper()
private constructor to prevent instantiation
|
Modifier and Type | Method and Description |
---|---|
static boolean |
asBoolean(java.lang.String text,
boolean defaultValue)
return a boolean value of a given string,
|
static java.util.List<org.w3c.dom.Element> |
getElements(org.w3c.dom.Node node)
return a list of all child elements of the given node
|
static java.util.List<org.w3c.dom.Element> |
getElements(org.w3c.dom.Node node,
javax.xml.namespace.QName qName)
return a list of all child elements of the given node which
match the given namespace and local name.
|
static java.util.List<org.w3c.dom.Element> |
getElements(org.w3c.dom.Node node,
java.lang.String localName)
return a list of all child elements of the given node which
match the given local name.
|
static java.util.List<org.w3c.dom.Element> |
getElements(org.w3c.dom.Node node,
java.lang.String uri,
java.lang.String localName)
return a list of all child elements of the given node which
match the given namespace and local name.
|
static org.w3c.dom.Element |
getFirstElement(org.w3c.dom.Node node)
return the first element
|
static org.w3c.dom.Element |
getFirstElement(org.w3c.dom.Node node,
javax.xml.namespace.QName qName)
return the first element with the given namespace/local name
|
static org.w3c.dom.Element |
getFirstElement(org.w3c.dom.Node node,
java.lang.String localName)
return the first element with the given local name
|
static org.w3c.dom.Element |
getFirstElement(org.w3c.dom.Node node,
java.lang.String uri,
java.lang.String localName)
return the first element with the given namespace/local name
|
static java.lang.String |
getFirstElementText(org.w3c.dom.Node node,
javax.xml.namespace.QName qName)
return the the text first element with the given namespace/local name
|
static java.lang.String |
getFirstElementText(org.w3c.dom.Node node,
java.lang.String localName)
return the text of the first matching element
|
static java.lang.String |
getFirstElementText(org.w3c.dom.Node node,
java.lang.String uri,
java.lang.String localName)
return the the text first element with the given namespace/local name
|
static org.w3c.dom.Element |
getNextElement(org.w3c.dom.Element el)
return the next sibling element
|
static boolean |
isNilled(org.w3c.dom.Element el)
return whether the given element is nilled
|
public static java.util.List<org.w3c.dom.Element> getElements(org.w3c.dom.Node node) throws org.w3c.dom.DOMException
node
- the parent nodeorg.w3c.dom.DOMException
- on DOM exceptisonpublic static java.util.List<org.w3c.dom.Element> getElements(org.w3c.dom.Node node, java.lang.String localName) throws org.w3c.dom.DOMException
Element.getElementsByTagName
, but it returns a list,
which is iterable.node
- the parent nodelocalName
- the element's local nameorg.w3c.dom.DOMException
- on DOM exceptionspublic static java.util.List<org.w3c.dom.Element> getElements(org.w3c.dom.Node node, java.lang.String uri, java.lang.String localName) throws org.w3c.dom.DOMException
Element.getElementsByTagName
, but it returns a list,
which is iterable.node
- the parent nodeuri
- the namespace URIlocalName
- the element's local name. If
null
, all elements matching
the given namespace are returnedorg.w3c.dom.DOMException
- on DOM exceptionspublic static java.util.List<org.w3c.dom.Element> getElements(org.w3c.dom.Node node, javax.xml.namespace.QName qName) throws org.w3c.dom.DOMException
Element.getElementsByTagName
, but it returns a list,
which is iterable.node
- the parent nodeqName
- the qualified nameorg.w3c.dom.DOMException
- on DOM exceptionspublic static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node) throws org.w3c.dom.DOMException
node
- the parent nodenull
if there is no matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static org.w3c.dom.Element getNextElement(org.w3c.dom.Element el)
el
- the elementnull
if
there is no next sibling elementpublic static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node, java.lang.String localName) throws org.w3c.dom.DOMException
node
- the parent nodelocalName
- the element's local namenull
if there is no matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node, java.lang.String uri, java.lang.String localName) throws org.w3c.dom.DOMException
node
- the parent nodeuri
- the namespace URIlocalName
- the element's local name. If
null
, the first element
matching the given namespace is returnednull
if there is no matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node, javax.xml.namespace.QName qName) throws org.w3c.dom.DOMException
node
- the parent nodeqName
- the qualified namenull
if there is no matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static java.lang.String getFirstElementText(org.w3c.dom.Node node, java.lang.String localName) throws org.w3c.dom.DOMException
node
- the parent nodelocalName
- the element's local namenull
if there is no
matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static java.lang.String getFirstElementText(org.w3c.dom.Node node, java.lang.String uri, java.lang.String localName) throws org.w3c.dom.DOMException
node
- the parent nodeuri
- the namespace URIlocalName
- the element's local name. If
null
, the first element
matching the given namespace is returnednull
if there is no
matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static java.lang.String getFirstElementText(org.w3c.dom.Node node, javax.xml.namespace.QName qName) throws org.w3c.dom.DOMException
node
- the parent nodeqName
- the qualified namenull
if there is no
matching elementorg.w3c.dom.DOMException
- on DOM exceptionspublic static boolean asBoolean(java.lang.String text, boolean defaultValue)
text
- the text, may be null
defaultValue
- the default valuetext
, as defined
by the boolean
XML Schema
datatype, or the default value if
text
is null or invalidpublic static boolean isNilled(org.w3c.dom.Element el) throws org.w3c.dom.DOMException
el
- the elementtrue
if nilled, i.e. has
the xsi:nil
attribute with
true
as a valueorg.w3c.dom.DOMException
- on DOM exceptionsCopyright © 2005-2013 Knipp Medien und Kommunikation GmbH