org.riotfamily.common.xml
Class XmlUtils
java.lang.Object
org.riotfamily.common.xml.XmlUtils
public class XmlUtils
- extends Object
Utility class that provides methods to create and populate beans from
DOM elements.
Method Summary |
static Document |
createDocument()
|
static String |
getAttribute(Element ele,
String name)
|
static boolean |
getBooleanAttribute(Element ele,
String name)
|
static List<Element> |
getChildElements(Element ele)
|
static List<Element> |
getChildElementsByRegex(Element ele,
String pattern)
|
static List<Element> |
getChildElementsByTagName(Element ele,
String name)
|
static Element |
getFirstChildByRegex(Element ele,
String pattern)
|
static Element |
getFirstChildByTagName(Element ele,
String tagName)
|
static Element |
getFirstChildElement(Element parent)
|
static int |
getIntAttribute(Element ele,
String name,
int defaultValue)
|
static Integer |
getIntegerAttribute(Element ele,
String name)
|
static String |
getLocalName(Node node)
|
static Element |
getNextSiblingElement(Node node)
|
static PropertyValue |
getPropertyValue(Element element,
String attr,
BeanFactory beanFactory)
|
static PropertyValues |
getPropertyValues(Element element,
String[] attributeNames,
BeanFactory beanFactory)
|
static PropertyValues |
getPropertyValues(NamedNodeMap attributes)
|
static void |
importAndAppend(Node node,
Node parent)
|
static Document |
parse(String xml)
|
static void |
populate(Object bean,
Element element,
String[] attributeNames)
|
static void |
populate(Object bean,
Element element,
String[] attributeNames,
BeanFactory beanFactory)
|
static void |
populate(Object bean,
List<Element> elements,
BeanFactory beanFactory)
|
static void |
populate(Object bean,
NamedNodeMap attributes)
|
static void |
removeAllChildNodes(Node node)
|
static void |
removeNode(Node node)
|
static String |
serialize(Node node)
|
static void |
setTextValue(Element element,
String value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlUtils
public XmlUtils()
getLocalName
public static String getLocalName(Node node)
getChildElements
public static List<Element> getChildElements(Element ele)
getChildElementsByTagName
public static List<Element> getChildElementsByTagName(Element ele,
String name)
getChildElementsByRegex
public static List<Element> getChildElementsByRegex(Element ele,
String pattern)
getFirstChildElement
public static Element getFirstChildElement(Element parent)
getFirstChildByTagName
public static Element getFirstChildByTagName(Element ele,
String tagName)
getFirstChildByRegex
public static Element getFirstChildByRegex(Element ele,
String pattern)
getNextSiblingElement
public static Element getNextSiblingElement(Node node)
getAttribute
public static String getAttribute(Element ele,
String name)
getIntegerAttribute
public static Integer getIntegerAttribute(Element ele,
String name)
getIntAttribute
public static int getIntAttribute(Element ele,
String name,
int defaultValue)
getBooleanAttribute
public static boolean getBooleanAttribute(Element ele,
String name)
populate
public static void populate(Object bean,
NamedNodeMap attributes)
getPropertyValues
public static PropertyValues getPropertyValues(NamedNodeMap attributes)
populate
public static void populate(Object bean,
Element element,
String[] attributeNames)
populate
public static void populate(Object bean,
Element element,
String[] attributeNames,
BeanFactory beanFactory)
getPropertyValues
public static PropertyValues getPropertyValues(Element element,
String[] attributeNames,
BeanFactory beanFactory)
getPropertyValue
public static PropertyValue getPropertyValue(Element element,
String attr,
BeanFactory beanFactory)
populate
public static void populate(Object bean,
List<Element> elements,
BeanFactory beanFactory)
createDocument
public static Document createDocument()
removeNode
public static void removeNode(Node node)
importAndAppend
public static void importAndAppend(Node node,
Node parent)
removeAllChildNodes
public static void removeAllChildNodes(Node node)
setTextValue
public static void setTextValue(Element element,
String value)
parse
public static Document parse(String xml)
serialize
public static String serialize(Node node)