net.sf.xmlmatcher.tools
Class Tools

java.lang.Object
  extended by net.sf.xmlmatcher.tools.Tools

public final class Tools
extends java.lang.Object


Constructor Summary
Tools()
           
 
Method Summary
static java.lang.String escape(java.lang.String input)
          Escape some character literals in input string
static boolean getBooleanAttribute(org.w3c.dom.Element element, java.lang.String attributeName, boolean defaultValue)
           
static java.util.List<org.w3c.dom.Element> getChildrenList(org.w3c.dom.Element parent)
           
static org.w3c.dom.Document getDOM(org.xml.sax.InputSource is)
           
static java.lang.String getElementTextContent(org.w3c.dom.Element element)
           
static java.lang.String getLocalName(org.w3c.dom.Node node)
           
static java.lang.String getNodeTextContent(org.w3c.dom.Node node)
           
static boolean hasChildElements(org.w3c.dom.Element parent)
           
static boolean xequals(java.lang.Object obj1, java.lang.Object obj2)
          Method identical to "obj1.equals(obj2)", it also handles null values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tools

public Tools()
Method Detail

getLocalName

public static java.lang.String getLocalName(org.w3c.dom.Node node)

getBooleanAttribute

public static boolean getBooleanAttribute(org.w3c.dom.Element element,
                                          java.lang.String attributeName,
                                          boolean defaultValue)

getNodeTextContent

public static java.lang.String getNodeTextContent(org.w3c.dom.Node node)
Returns:
Text content of given node. For elements this function is equivalent to getElementTextContent(Element). For other node types result equal to Node.getNodeValue().

getElementTextContent

public static java.lang.String getElementTextContent(org.w3c.dom.Element element)
Returns:
Text value of given element. Returns empty string if given element has no text children. If given element has mixed content, result contains concatenation of text values from all children elements.

xequals

public static boolean xequals(java.lang.Object obj1,
                              java.lang.Object obj2)
Method identical to "obj1.equals(obj2)", it also handles null values.


getChildrenList

public static java.util.List<org.w3c.dom.Element> getChildrenList(org.w3c.dom.Element parent)
Returns:
all children Elements of given parent (never null)

hasChildElements

public static boolean hasChildElements(org.w3c.dom.Element parent)
Returns:
true if given Element has at least one child element

getDOM

public static org.w3c.dom.Document getDOM(org.xml.sax.InputSource is)
                                   throws java.io.IOException
Throws:
java.io.IOException

escape

public static java.lang.String escape(java.lang.String input)
Escape some character literals in input string



Copyright © 2007. All Rights Reserved.