net.sourceforge.sqlunit.utils
Class XMLUtils

java.lang.Object
  extended by net.sourceforge.sqlunit.utils.XMLUtils

public final class XMLUtils
extends java.lang.Object

Provides commonly used functionality for methods which have to deal with JDOM elements.

Version:
$Revision: 1.6 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Method Summary
static java.lang.String getAttributeValue(org.jdom.Element element, java.lang.String attribute)
          Wrapper over Element.getAttributeValue(attributeName) which tests to see if the attributeName is a variable, if so, does another lookup of the symbol table to return the value of the variable.
static java.lang.String getText(org.jdom.Element element)
          Wrapper over Element.getText() which tests to see if the body text returned is a variable, if so, does another lookup of the symbol table to return the value of the variable.
static java.lang.String stripCRLF(java.lang.String unstripped)
          Replaces all occurences of CRLF, CR and LF with a single space and returns the trimmed result string.
static java.lang.String toXMLString(org.jdom.Element element)
          Converts the Element to a formatted XML String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAttributeValue

public static java.lang.String getAttributeValue(org.jdom.Element element,
                                                 java.lang.String attribute)
Wrapper over Element.getAttributeValue(attributeName) which tests to see if the attributeName is a variable, if so, does another lookup of the symbol table to return the value of the variable.

Parameters:
element - the JDOM Element.
attribute - the name of the attribute.
Returns:
the value of the attribute, or the value for the variable stored in the SymbolTable if the value is a variable.

getText

public static java.lang.String getText(org.jdom.Element element)
Wrapper over Element.getText() which tests to see if the body text returned is a variable, if so, does another lookup of the symbol table to return the value of the variable.

Parameters:
element - the JDOM Element.
Returns:
the value of the body text, or the value for the variable stored in the SymbolTable if the value is a variable.

toXMLString

public static java.lang.String toXMLString(org.jdom.Element element)
Converts the Element to a formatted XML String.

Parameters:
element - the JDOM Element.
Returns:
a formatted XML String representing the Element.

stripCRLF

public static java.lang.String stripCRLF(java.lang.String unstripped)
Replaces all occurences of CRLF, CR and LF with a single space and returns the trimmed result string.

Parameters:
unstripped - the unstripped string.
Returns:
the stripped string.