Package org.ofbiz.core.util
Class UtilXml
java.lang.Object
org.ofbiz.core.util.UtilXml
Utilities methods to simplify dealing with JAXP & DOM XML parsing
- Since:
- 2.0
- Version:
- $Revision: 1.1 $
- Author:
- David E. Jones
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLocal error handler for entity resolver to DocumentBuilder parser.static classLocal entity resolver to handle J2EE DTDs. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ElementaddChildElement(Element element, String childElementName, Document document) Creates a child element with the given name and appends it to the element child node list.static ElementaddChildElementCDATAValue(Element element, String childElementName, String childElementValue, Document document) Creates a child element with the given name and appends it to the element child node list.static ElementaddChildElementValue(Element element, String childElementName, String childElementValue, Document document) Creates a child element with the given name and appends it to the element child node list.static booleancheckBoolean(String str) static booleancheckBoolean(String str, boolean defaultValue) static StringcheckEmpty(String string) static StringcheckEmpty(String string1, String string2) static StringcheckEmpty(String string1, String string2, String string3) childElementList(Element element, String childElementName) Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.static StringchildElementValue(Element element, String childElementName) Return the text (node value) contained by the named child node.static StringchildElementValue(Element element, String childElementName, String defaultValue) Return the text (node value) contained by the named child node or a default value if null.static StringelementValue(Element element) Return the text (node value) of the first node under this, works best if normalized.static ElementfirstChildElement(Element element, String childElementName) Return the first child Element with the given name; if name is null returns the first element.static ElementfirstChildElement(Element element, String childElementName, String attrName, String attrValue) Return the first child Element with the given name; if name is null returns the first element.static Documentstatic DocumentmakeEmptyXmlDocument(String rootElementName) static Documentstatic DocumentreadXmlDocument(InputStream is, boolean validate, String docDescription) static DocumentreadXmlDocument(String content) static DocumentreadXmlDocument(String content, boolean validate) static DocumentreadXmlDocument(URL url) static DocumentreadXmlDocument(URL url, boolean validate) static voidwriteXmlDocument(OutputStream os, Document document) static voidwriteXmlDocument(String filename, Document document) static StringwriteXmlDocument(Document document)
-
Field Details
-
module
-
-
Constructor Details
-
UtilXml
public UtilXml()
-
-
Method Details
-
writeXmlDocument
- Throws:
IOException
-
writeXmlDocument
public static void writeXmlDocument(String filename, Document document) throws FileNotFoundException, IOException - Throws:
FileNotFoundExceptionIOException
-
writeXmlDocument
- Throws:
IOException
-
readXmlDocument
public static Document readXmlDocument(String content) throws SAXException, ParserConfigurationException, IOException -
readXmlDocument
public static Document readXmlDocument(String content, boolean validate) throws SAXException, ParserConfigurationException, IOException -
readXmlDocument
public static Document readXmlDocument(URL url) throws SAXException, ParserConfigurationException, IOException -
readXmlDocument
public static Document readXmlDocument(URL url, boolean validate) throws SAXException, ParserConfigurationException, IOException -
readXmlDocument
public static Document readXmlDocument(InputStream is) throws SAXException, ParserConfigurationException, IOException -
readXmlDocument
public static Document readXmlDocument(InputStream is, boolean validate, String docDescription) throws SAXException, ParserConfigurationException, IOException -
makeEmptyXmlDocument
-
makeEmptyXmlDocument
-
addChildElement
Creates a child element with the given name and appends it to the element child node list. -
addChildElementValue
public static Element addChildElementValue(Element element, String childElementName, String childElementValue, Document document) Creates a child element with the given name and appends it to the element child node list. Also creates a Text node with the given value and appends it to the new elements child node list. -
addChildElementCDATAValue
public static Element addChildElementCDATAValue(Element element, String childElementName, String childElementValue, Document document) Creates a child element with the given name and appends it to the element child node list. Also creates a CDATASection node with the given value and appends it to the new elements child node list. -
childElementList
Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included. -
firstChildElement
Return the first child Element with the given name; if name is null returns the first element. -
firstChildElement
public static Element firstChildElement(Element element, String childElementName, String attrName, String attrValue) Return the first child Element with the given name; if name is null returns the first element. -
childElementValue
Return the text (node value) contained by the named child node. -
childElementValue
public static String childElementValue(Element element, String childElementName, String defaultValue) Return the text (node value) contained by the named child node or a default value if null. -
elementValue
Return the text (node value) of the first node under this, works best if normalized. -
checkEmpty
-
checkEmpty
-
checkEmpty
-
checkBoolean
-
checkBoolean
-