Class DomUtil
java.lang.Object
org.apache.commons.modeler.util.DomUtil
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodefindChildWithAtt(Node parent, String elemName, String attName, String attVal) Find the first direct child with a given attribute.static StringgetAttribute(Node element, String attName) static NodeGet the first direct child with a given typestatic NodeGet the first element child.static StringgetChildContent(Node parent, String name) Get the first child's content ( ie it's included TEXT node ).static StringgetContent(Node n) Get the trimed text content of a node or null if there is no textstatic NodeGet the next sibling with the same name and typestatic NodeReturn the next sibling with a given name and typestatic DocumentreadXml(InputStream is) Read XML as DOM.static voidremoveAttribute(Node node, String attName) static voidsetAttribute(Node node, String attName, String val) static voidsetAttributes(Object o, Node parent) static voidSet or replace the text valuestatic voidwriteXml(Node n, OutputStream os)
-
Field Details
-
log
private static org.apache.commons.logging.Log log
-
-
Constructor Details
-
DomUtil
public DomUtil()
-
-
Method Details
-
getContent
-
getChild
-
getAttribute
-
setAttribute
-
removeAttribute
-
setText
-
findChildWithAtt
Find the first direct child with a given attribute.- Parameters:
parent-elemName- name of the element, or null for anyattName- attribute we're looking forattVal- attribute value or null if we just want any
-
getChildContent
-
getChild
-
getNext
-
getNext
-
setAttributes
-
readXml
public static Document readXml(InputStream is) throws SAXException, IOException, ParserConfigurationException Read XML as DOM. -
writeXml
- Throws:
TransformerException
-