org.jbpm.xml
Class XmlUtil

java.lang.Object
  extended by org.jbpm.xml.XmlUtil

public abstract class XmlUtil
extends java.lang.Object

convenience methods to make reading org.w3c.dom models easier.

Author:
Tom Baeyens

Nested Class Summary
static class XmlUtil.NamespaceValue
           
 
Constructor Summary
XmlUtil()
           
 
Method Summary
static java.lang.String attribute(org.w3c.dom.Element element, java.lang.String attributeName)
          the attribute value or null if the attribute is not present
static java.lang.String attribute(org.w3c.dom.Element element, java.lang.String attributeName, boolean required, Parse parse)
          convenience method to combine extraction of a string attribute value.
static java.lang.Boolean attributeBoolean(org.w3c.dom.Element element, java.lang.String attributeName, boolean required, Parse parse)
          parse an attribute as an boolean.
static java.lang.Integer attributeInteger(org.w3c.dom.Element element, java.lang.String attributeName, boolean required, Parse parse)
          parse an attribute as an integer.
static XmlUtil.NamespaceValue attributeNamespaceValue(org.w3c.dom.Element element, java.lang.String attributeName)
           
static javax.xml.namespace.QName attributeQName(org.w3c.dom.Element element, java.lang.String attributeName)
           
static java.util.List<org.w3c.dom.Attr> attributes(org.w3c.dom.Element element)
           
static java.util.List<org.w3c.dom.Node> contents(org.w3c.dom.Element element)
           
static org.w3c.dom.Element element(org.w3c.dom.Element element)
           
static org.w3c.dom.Element element(org.w3c.dom.Element element, java.lang.String tagName)
           
static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element element)
           
static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element element, java.util.Set<java.lang.String> allowedTagNames)
           
static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element element, java.lang.String tagName)
           
static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element father, java.lang.String ns, java.lang.String localName)
           
static java.util.List<org.w3c.dom.Element> elementsQName(org.w3c.dom.Element element, java.util.Set<javax.xml.namespace.QName> allowedTagNames)
           
static java.lang.String errorMessageAttribute(org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String message)
           
static java.lang.String getContentText(org.w3c.dom.Element element)
           
static java.lang.String getNamespaceURI(org.w3c.dom.Node n, java.lang.String prefix)
           
static javax.xml.namespace.QName getQNameFromString(org.w3c.dom.Element element, java.lang.String qnameAsString)
           
static java.lang.String getTagName(org.w3c.dom.Element element)
           
static boolean isTextOnly(org.w3c.dom.Element element)
           
static java.util.List<java.lang.String> parseCommaSeparatedList(java.lang.String commaSeparatedListText)
          parses comma or space separated list.
static java.util.List<java.lang.String> parseList(org.w3c.dom.Element element, java.lang.String singularTagName)
           
static java.lang.String toString(org.w3c.dom.Element element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlUtil

public XmlUtil()
Method Detail

elements

public static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element element,
                                                           java.lang.String tagName)

elements

public static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element element,
                                                           java.util.Set<java.lang.String> allowedTagNames)

element

public static org.w3c.dom.Element element(org.w3c.dom.Element element,
                                          java.lang.String tagName)

elements

public static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element element)

elements

public static java.util.List<org.w3c.dom.Element> elements(org.w3c.dom.Element father,
                                                           java.lang.String ns,
                                                           java.lang.String localName)

elementsQName

public static java.util.List<org.w3c.dom.Element> elementsQName(org.w3c.dom.Element element,
                                                                java.util.Set<javax.xml.namespace.QName> allowedTagNames)

element

public static org.w3c.dom.Element element(org.w3c.dom.Element element)

toString

public static java.lang.String toString(org.w3c.dom.Element element)

getContentText

public static java.lang.String getContentText(org.w3c.dom.Element element)

isTextOnly

public static boolean isTextOnly(org.w3c.dom.Element element)

attributes

public static java.util.List<org.w3c.dom.Attr> attributes(org.w3c.dom.Element element)

contents

public static java.util.List<org.w3c.dom.Node> contents(org.w3c.dom.Element element)

getTagName

public static java.lang.String getTagName(org.w3c.dom.Element element)

attribute

public static java.lang.String attribute(org.w3c.dom.Element element,
                                         java.lang.String attributeName)
the attribute value or null if the attribute is not present


attribute

public static java.lang.String attribute(org.w3c.dom.Element element,
                                         java.lang.String attributeName,
                                         boolean required,
                                         Parse parse)
convenience method to combine extraction of a string attribute value. If the attribute exists, it is returned. If the attribute is not present, the defaultValue is returned. The attribute is not present and it is required, a problem will be added to the parse.


attributeInteger

public static java.lang.Integer attributeInteger(org.w3c.dom.Element element,
                                                 java.lang.String attributeName,
                                                 boolean required,
                                                 Parse parse)
parse an attribute as an integer.


attributeBoolean

public static java.lang.Boolean attributeBoolean(org.w3c.dom.Element element,
                                                 java.lang.String attributeName,
                                                 boolean required,
                                                 Parse parse)
parse an attribute as an boolean.


errorMessageAttribute

public static java.lang.String errorMessageAttribute(org.w3c.dom.Element element,
                                                     java.lang.String attributeName,
                                                     java.lang.String attributeValue,
                                                     java.lang.String message)

parseList

public static java.util.List<java.lang.String> parseList(org.w3c.dom.Element element,
                                                         java.lang.String singularTagName)

parseCommaSeparatedList

public static java.util.List<java.lang.String> parseCommaSeparatedList(java.lang.String commaSeparatedListText)
parses comma or space separated list. A null return value means a wildcard.

Returns:
List of tokens or null if the commaSeparatedListText is null, '*', or empty

attributeNamespaceValue

public static XmlUtil.NamespaceValue attributeNamespaceValue(org.w3c.dom.Element element,
                                                             java.lang.String attributeName)

attributeQName

public static javax.xml.namespace.QName attributeQName(org.w3c.dom.Element element,
                                                       java.lang.String attributeName)

getQNameFromString

public static javax.xml.namespace.QName getQNameFromString(org.w3c.dom.Element element,
                                                           java.lang.String qnameAsString)

getNamespaceURI

public static java.lang.String getNamespaceURI(org.w3c.dom.Node n,
                                               java.lang.String prefix)