Package org.owasp.validator.html.util
Class XMLUtil
- java.lang.Object
-
- org.owasp.validator.html.util.XMLUtil
-
public class XMLUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description XMLUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
decode(java.lang.String str)
Helper function for decode XML entities.static java.lang.String
encode(java.lang.String str)
static java.lang.String
getAttributeValue(org.w3c.dom.Element ele, java.lang.String attrName)
Helper function for quickly retrieving an attribute from a given element.static boolean
getBooleanValue(org.w3c.dom.Element ele, java.lang.String tagName)
Helper function for quickly retrieving an boolean value of a given XML element.static boolean
getBooleanValue(org.w3c.dom.Element ele, java.lang.String tagName, boolean defaultValue)
Helper function for quickly retrieving an boolean value of a given XML element, with a default initialization value passed in a parameter.static int
getIntValue(org.w3c.dom.Element ele, java.lang.String tagName, int defaultValue)
Helper function for quickly retrieving an integer value of a given XML element.static java.lang.String
getTextValue(org.w3c.dom.Element ele, java.lang.String tagName)
Helper function for quickly retrieving a String value of a given XML element.
-
-
-
Method Detail
-
getAttributeValue
public static java.lang.String getAttributeValue(org.w3c.dom.Element ele, java.lang.String attrName)
Helper function for quickly retrieving an attribute from a given element.- Parameters:
ele
- The document element from which to pull the attribute value.attrName
- The name of the attribute.- Returns:
- The value of the attribute contained within the element
-
getIntValue
public static int getIntValue(org.w3c.dom.Element ele, java.lang.String tagName, int defaultValue)
Helper function for quickly retrieving an integer value of a given XML element.- Parameters:
ele
- The document element from which to pull the integer value.tagName
- The name of the node.- Returns:
- The integer value of the given node in the element passed in.
-
getTextValue
public static java.lang.String getTextValue(org.w3c.dom.Element ele, java.lang.String tagName)
Helper function for quickly retrieving a String value of a given XML element.- Parameters:
ele
- The document element from which to pull the String value.tagName
- The name of the node.- Returns:
- The String value of the given node in the element passed in.
-
getBooleanValue
public static boolean getBooleanValue(org.w3c.dom.Element ele, java.lang.String tagName)
Helper function for quickly retrieving an boolean value of a given XML element.- Parameters:
ele
- The document element from which to pull the boolean value.tagName
- The name of the node.- Returns:
- The boolean value of the given node in the element passed in.
-
getBooleanValue
public static boolean getBooleanValue(org.w3c.dom.Element ele, java.lang.String tagName, boolean defaultValue)
Helper function for quickly retrieving an boolean value of a given XML element, with a default initialization value passed in a parameter.- Parameters:
ele
- The document element from which to pull the boolean value.tagName
- The name of the node.defaultValue
- The default value of the node if it's value can't be processed.- Returns:
- The boolean value of the given node in the element passed in.
-
decode
public static java.lang.String decode(java.lang.String str)
Helper function for decode XML entities.- Parameters:
str
- The XML-encoded String to decode.- Returns:
- An XML-decoded String.
-
encode
public static java.lang.String encode(java.lang.String str)
-
-