public class XMLUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
logger
The logger.
|
| Constructor and Description |
|---|
XMLUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addChildValue(org.dom4j.Element parent,
String childName,
String childValue)
Adds the child value.
|
static String |
getAttribute(org.dom4j.Element element,
String attributeName)
Gets an attribute from the given element with the given attribute name
|
static org.dom4j.Element |
getChild(org.dom4j.Element parent,
String name)
Gets the child.
|
static List |
getChildren(org.dom4j.Element element)
Gets the children.
|
static List |
getChildren(org.dom4j.Element element,
String name)
Gets the children.
|
static String |
getChildValue(org.dom4j.Element element,
String name)
Gets the child value.
|
static String |
getDocumentChildValue(org.dom4j.Document d,
String name)
Gets the document child value.
|
static String |
getValue(org.dom4j.Element element)
Gets the value.
|
static org.dom4j.Document |
parse(InputStream stream)
Parses the given stream to an XML document (in UTF-8 format).
|
static org.dom4j.Document |
parse(String xml)
Parses the.
|
static void |
setChildValue(org.dom4j.Element element,
String name,
String value)
Sets the child value.
|
static void |
setDocumentChildValue(org.dom4j.Document d,
String name,
String value)
Sets the document child value.
|
static void |
setValue(org.dom4j.Element element,
String value)
Sets the value.
|
static String |
toXML(org.dom4j.Document document)
Converts the document to XML.
|
static String |
toXML(org.dom4j.Document document,
boolean pretty)
Converts the document to XML.
|
public static void addChildValue(org.dom4j.Element parent,
String childName,
String childValue)
parent - the parentchildName - the child namechildValue - the child valuepublic static org.dom4j.Element getChild(org.dom4j.Element parent,
String name)
parent - the parentname - the namepublic static String getValue(org.dom4j.Element element)
element - the elementpublic static void setValue(org.dom4j.Element element,
String value)
element - the elementvalue - the valuepublic static String getChildValue(org.dom4j.Element element, String name)
element - the elementname - the namepublic static void setChildValue(org.dom4j.Element element,
String name,
String value)
element - the elementname - the namevalue - the valuepublic static List getChildren(org.dom4j.Element element)
element - the elementpublic static List getChildren(org.dom4j.Element element, String name)
element - the elementname - the namepublic static String getAttribute(org.dom4j.Element element, String attributeName)
element - the elementattributeName - the attribute namepublic static String getDocumentChildValue(org.dom4j.Document d, String name)
d - the dname - the namepublic static void setDocumentChildValue(org.dom4j.Document d,
String name,
String value)
throws Exception
d - the dname - the namevalue - the valueException - the exceptionpublic static org.dom4j.Document parse(String xml) throws org.dom4j.DocumentException
xml - the xmlorg.dom4j.DocumentException - the document exceptionpublic static org.dom4j.Document parse(InputStream stream) throws org.dom4j.DocumentException, IOException
stream - the streamorg.dom4j.DocumentException - the document exceptionIOException - Signals that an I/O exception has occurred.public static String toXML(org.dom4j.Document document)
document - the documentpublic static String toXML(org.dom4j.Document document, boolean pretty)
document - the documentpretty - whether to produce human readable XMLCopyright © 2005–2016 Alfresco Software. All rights reserved.