|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.knipp.rritoolkit.XmlHelper
public class XmlHelper
helper class that simplifies the parsing of DOM trees
Constructor Summary | |
---|---|
private |
XmlHelper()
private constructor to prevent instantiation |
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private XmlHelper()
Method Detail |
---|
public static java.util.List<org.w3c.dom.Element> getElements(org.w3c.dom.Node node) throws org.w3c.dom.DOMException
node
- the parent node
org.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 name
org.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 returned
org.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 name
org.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 node
null
if there is no matching element
org.w3c.dom.DOMException
- on DOM exceptionspublic static org.w3c.dom.Element getNextElement(org.w3c.dom.Element el)
el
- the element
null
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 name
null
if there is no matching element
org.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 returned
null
if there is no matching element
org.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 name
null
if there is no matching element
org.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 name
null
if there is no
matching element
org.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 returned
null
if there is no
matching element
org.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 name
null
if there is no
matching element
org.w3c.dom.DOMException
- on DOM exceptionspublic static boolean asBoolean(java.lang.String text, boolean defaultValue)
text
- the text, may be null
defaultValue
- the default value
text
, 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 element
true
if nilled, i.e. has
the xsi:nil
attribute with
true
as a value
org.w3c.dom.DOMException
- on DOM exceptions
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |