org.jboss.cache.xml
Class XmlHelper
java.lang.Object
org.jboss.cache.xml.XmlHelper
public class XmlHelper
- extends java.lang.Object
A simple XML utility class for reading configuration elements
- Author:
- Manik Surtani (manik@jboss.org)
Field Summary |
static java.lang.String |
ATTR
|
static java.lang.String |
CONFIG_ATTR
|
static java.lang.String |
NAME
|
static java.lang.String |
ROOT
|
Method Summary |
static java.lang.String |
escapeBackslashes(java.lang.String value)
|
static java.lang.String |
getAttributeValue(org.w3c.dom.Element elem,
java.lang.String tagName,
java.lang.String attributeName)
Retrieves the value of a given attribute for the first encountered instance of a tag in an element. |
static org.w3c.dom.Element |
getConfigSubElement(org.w3c.dom.Element element)
|
static org.w3c.dom.Element |
getDocumentRoot(java.io.InputStream is)
|
static java.lang.String |
getElementContent(org.w3c.dom.Element element,
boolean trim)
|
static org.w3c.dom.Element |
getSubElement(org.w3c.dom.Element element,
java.lang.String subElementName)
|
static java.lang.String |
getTagContents(org.w3c.dom.Element elem,
java.lang.String myName,
java.lang.String tagName,
java.lang.String attributeName)
Returns the contents of a specific node of given tagName, provided a certain attribute exists and contains value myValue. |
static boolean |
readBooleanAttribute(org.w3c.dom.Element elem,
java.lang.String tagName,
java.lang.String attributeName,
boolean defaultValue)
Retrieves the boolean value of a given attribute for the first encountered instance of a tag in an element. |
static boolean |
readBooleanContents(org.w3c.dom.Element element,
java.lang.String tagName)
|
static boolean |
readBooleanContents(org.w3c.dom.Element element,
java.lang.String tagName,
boolean defaultValue)
|
static java.util.Properties |
readPropertiesContents(org.w3c.dom.Element element,
java.lang.String tagName)
|
static java.lang.String |
readStringContents(org.w3c.dom.Element element,
java.lang.String tagName)
|
static org.w3c.dom.Element |
stringToElement(java.lang.String xml)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ROOT
public static final java.lang.String ROOT
- See Also:
- Constant Field Values
ATTR
public static final java.lang.String ATTR
- See Also:
- Constant Field Values
CONFIG_ATTR
public static final java.lang.String CONFIG_ATTR
- See Also:
- Constant Field Values
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
XmlHelper
public XmlHelper()
getTagContents
public static java.lang.String getTagContents(org.w3c.dom.Element elem,
java.lang.String myName,
java.lang.String tagName,
java.lang.String attributeName)
- Returns the contents of a specific node of given tagName, provided a certain attribute exists and contains value myValue.
- Parameters:
elem
- myName
- tagName
- attributeName
-
getAttributeValue
public static java.lang.String getAttributeValue(org.w3c.dom.Element elem,
java.lang.String tagName,
java.lang.String attributeName)
- Retrieves the value of a given attribute for the first encountered instance of a tag in an element.
- Parameters:
elem
- tagName
- attributeName
-
getConfigSubElement
public static org.w3c.dom.Element getConfigSubElement(org.w3c.dom.Element element)
getSubElement
public static org.w3c.dom.Element getSubElement(org.w3c.dom.Element element,
java.lang.String subElementName)
getElementContent
public static java.lang.String getElementContent(org.w3c.dom.Element element,
boolean trim)
readStringContents
public static java.lang.String readStringContents(org.w3c.dom.Element element,
java.lang.String tagName)
escapeBackslashes
public static java.lang.String escapeBackslashes(java.lang.String value)
readPropertiesContents
public static java.util.Properties readPropertiesContents(org.w3c.dom.Element element,
java.lang.String tagName)
throws java.io.IOException
- Throws:
java.io.IOException
readBooleanContents
public static boolean readBooleanContents(org.w3c.dom.Element element,
java.lang.String tagName)
readBooleanContents
public static boolean readBooleanContents(org.w3c.dom.Element element,
java.lang.String tagName,
boolean defaultValue)
stringToElement
public static org.w3c.dom.Element stringToElement(java.lang.String xml)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDocumentRoot
public static org.w3c.dom.Element getDocumentRoot(java.io.InputStream is)
readBooleanAttribute
public static boolean readBooleanAttribute(org.w3c.dom.Element elem,
java.lang.String tagName,
java.lang.String attributeName,
boolean defaultValue)
- Retrieves the boolean value of a given attribute for the first encountered instance of a tag in an element.
- Parameters:
elem
- tagName
- attributeName
- defaultValue
-