org.jbpm.pvm.internal.util
Class XmlUtil

java.lang.Object
  extended by org.jbpm.pvm.internal.util.XmlUtil

public 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
           
 
Method Summary
static java.lang.String attribute(org.w3c.dom.Element element, java.lang.String attributeName)
          retrieves an attribute value by name.
static java.lang.String attribute(org.w3c.dom.Element element, java.lang.String attributeName, Parse parse)
          retrieves an attribute value by name. if the attribute is not present, a problem will be added to the parse.
static java.lang.String attribute(org.w3c.dom.Element element, java.lang.String attributeName, Parse parse, java.lang.String defaultValue)
          retrieves an attribute value by name. if the attribute is not present, a problem will be added to the parse.
static java.lang.String attribute(org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String defaultValue)
          retrieves an attribute value by name.
static java.lang.Boolean attributeBoolean(org.w3c.dom.Element element, java.lang.String attributeName, Parse parse)
          parse an attribute as an boolean.
static java.lang.Integer attributeInteger(org.w3c.dom.Element element, java.lang.String attributeName, Parse parse)
          retrieves an attribute value by name.
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 org.w3c.dom.Element element(org.w3c.dom.Element element, java.lang.String tagName, Parse parse)
           
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 element, java.lang.String namespace, 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 boolean isTextOnly(org.w3c.dom.Element element)
           
static java.lang.Boolean parseBooleanValue(java.lang.String valueText)
           
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.Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

element

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

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 element,
                                                           java.lang.String namespace,
                                                           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.Node node)

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)

attribute

public static java.lang.String attribute(org.w3c.dom.Element element,
                                         java.lang.String attributeName)
retrieves an attribute value by name.

Returns:
the attribute value or null if there is no such attribute

attribute

public static java.lang.String attribute(org.w3c.dom.Element element,
                                         java.lang.String attributeName,
                                         java.lang.String defaultValue)
retrieves an attribute value by name.

Returns:
the attribute value or defaultValue if there is no such attribute

attribute

public static java.lang.String attribute(org.w3c.dom.Element element,
                                         java.lang.String attributeName,
                                         Parse parse)
retrieves an attribute value by name. if the attribute is not present, a problem will be added to the parse.

Returns:
the attribute value or null if there is no such attribute

attribute

public static java.lang.String attribute(org.w3c.dom.Element element,
                                         java.lang.String attributeName,
                                         Parse parse,
                                         java.lang.String defaultValue)
retrieves an attribute value by name. if the attribute is not present, a problem will be added to the parse.

Returns:
the attribute value or defaultValue if there is no such attribute

attributeInteger

public static java.lang.Integer attributeInteger(org.w3c.dom.Element element,
                                                 java.lang.String attributeName,
                                                 Parse parse)
retrieves an attribute value by name.


attributeBoolean

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


parseBooleanValue

public static java.lang.Boolean parseBooleanValue(java.lang.String valueText)

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)


Copyright © 2010 JBoss Community. All Rights Reserved.