|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectschmitzm.xml.XMLUtil
public class XMLUtil
Diese Klasse enthaelt statische Helper-Methoden fuer das Arbeiten mit XML.
Field Summary | |
---|---|
static JAXPDOMAdapter |
JDOM_TO_JAX
Wrapper from JDOM to W3C. |
static XMLOutputter |
XML_OUTPUTTER
Writes XML element to file. |
Constructor Summary | |
---|---|
XMLUtil()
|
Method Summary | |
---|---|
static String |
getAttribute(Element element,
String attrName,
String... defValue)
Gets the attribute value from element. |
static Boolean |
getBooleanAttribute(Element element,
String attrName,
Boolean... defValue)
Gets the attribute value from element as Boolean . |
static Color |
getColorAttribute(Element element,
String attrName,
Color... defValue)
Gets the attribute value from element as Color . |
static Double |
getDoubleAttribute(Element element,
String attrName,
Double... defValue)
Gets the attribute value from element as Double . |
static Float |
getFloatAttribute(Element element,
String attrName,
Float... defValue)
Gets the attribute value from element as Float . |
static Integer |
getIntegerAttribute(Element element,
String attrName,
Integer... defValue)
Gets the attribute value from element as Integer . |
static boolean |
setAttribute(Element element,
String attrName,
Object value,
boolean inclNullAttr)
Sets an attribute value. |
static boolean |
setNotNullAttribute(Element element,
String attrName,
Object value)
Sets an attribute value if the value is not null . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final JAXPDOMAdapter JDOM_TO_JAX
public static final XMLOutputter XML_OUTPUTTER
Constructor Detail |
---|
public XMLUtil()
Method Detail |
---|
public static String getAttribute(Element element, String attrName, String... defValue)
element
- element where the attribute is determined fromattrName
- name of the attributedefValue
- default value returned if attribute is not found (or empty)
null
if element
is null
or attribute is not
specified in elementpublic static Boolean getBooleanAttribute(Element element, String attrName, Boolean... defValue)
Boolean
.
element
- element where the attribute is determined fromattrName
- name of the attributedefValue
- optional default value returned if attribute is not found (or empty)
null
if element
is null
or attribute is not
specified in elementpublic static Integer getIntegerAttribute(Element element, String attrName, Integer... defValue)
Integer
.
element
- element where the attribute is determined fromattrName
- name of the attributedefValue
- optional default value returned if attribute is not found (or empty)
null
if element
is null
or attribute is not
specified in elementpublic static Double getDoubleAttribute(Element element, String attrName, Double... defValue)
Double
.
element
- element where the attribute is determined fromattrName
- name of the attributedefValue
- optional default value returned if attribute is not found (or empty)
null
if element
is null
or attribute is not
specified in elementpublic static Float getFloatAttribute(Element element, String attrName, Float... defValue)
Float
.
element
- element where the attribute is determined fromattrName
- name of the attributedefValue
- optional default value returned if attribute is not found (or empty)
null
if element
is null
or attribute is not
specified in elementpublic static Color getColorAttribute(Element element, String attrName, Color... defValue)
Color
.
element
- element where the attribute is determined fromattrName
- name of the attributedefValue
- optional default value returned if attribute is not found (or empty)
null
if element
is null
or attribute is not
specified in elementpublic static boolean setAttribute(Element element, String attrName, Object value, boolean inclNullAttr)
.toString()
method is used
to convert the object value to string.Color
: the color is converted to hex rgb string
element
- element the attribute is set forattrName
- name of the attribute to setvalue
- attribute valueinclNullAttr
- if false
and value
is null
the attribute is NOT SET
true
if the attribute is setpublic static boolean setNotNullAttribute(Element element, String attrName, Object value)
null
.
The .toString()
method is used to convert the object
value to string.Color
: the color is converted to hex rgb string
element
- element the attribute is set forattrName
- name of the attribute to setvalue
- attribute value
true
if the attribute is set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |