List of utility methods to do XML CDATA Get
String | getCDATA(Element elem) get CDATA return getCDATA(elem, true);
|
String | getCdata(Element elem) Extracts the first CDATA child from the given org.w3c.dom.Element . NodeList nodes = elem.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.CDATA_SECTION_NODE) { CharacterData cdataNode = (CharacterData) node; return cdataNode.getData(); return null; |
String | getCData(Element element) Extract the CDATA content of the specified element. CDATASection text = getCDataNode(element); if (text != null) return text.getData().trim(); else return null; |
CDATASection | getCDataNode(Element element) Returns element's CDATA child node (if it has one). return (CDATASection) getChildByType(element, Node.CDATA_SECTION_NODE);
|
String | getCDataValue(Node node, String tag) Returns the CDATA value of the subnode of specified node with the specified tag. String ret = null; Node child = getChildNode(node, tag); if (child != null) { NodeList grandchildren = child.getChildNodes(); Node grandchild = grandchildren.item(0); if (grandchild != null) { ret = grandchild.getNodeValue(); return ret; |
String | getChildCdata(Node element, String name) get Child Cdata for (Node node : iter(element.getChildNodes())) { if (node.getNodeName().equals(name)) { StringBuilder buf = new StringBuilder(); textRecurse(node, buf); return buf.toString(); return null; ... |
String | getChildCharacterData(Element parentEl) Concat all the text and cdata node children of this elem and return the resulting text. if (parentEl == null) { return null; Node tempNode = parentEl.getFirstChild(); StringBuffer strBuf = new StringBuffer(); CharacterData charData; while (tempNode != null) { switch (tempNode.getNodeType()) { ... |
String | getChildCharacterData(Element parentEl) Concat all the text and cdata node children of this elem and return the resulting text. if (parentEl == null) { return null; Node tempNode = parentEl.getFirstChild(); StringBuffer strBuf = new StringBuffer(); CharacterData charData; while (tempNode != null) { switch (tempNode.getNodeType()) { ... |
String | getElementCDATAByTagName(Element current, String name, String namespace) get Element CDATA By Tag Name Element e = getElementByTagName(current, name, namespace); if (e == null) return null; Node child = e.getFirstChild(); if (child == null) return null; return child.getNodeValue(); |