List of utility methods to do XML CDATA Add
String | addCDATA(final String xML) add CDATA String cStart = "<![CDATA["; String cEnd = "]]>"; return new StringBuilder().append(cStart).append(xML).append(cEnd).toString(); |
String | addCData(String xml) Adds the CDATA protection to an XML String String cdataXml = "<![CDATA["; cdataXml += xml; cdataXml += "]]>"; return cdataXml; |
Element | addCDATAElement(Node parent, String name, String data, Attr[] attrs) Add a CDATA element with attributes. Element element; CDATASection cdata; if (parent instanceof Document) { element = ((Document) parent).createElement(name); cdata = ((Document) parent).createCDATASection(data); } else { element = parent.getOwnerDocument().createElement(name); cdata = parent.getOwnerDocument().createCDATASection(data); ... |
void | addCdataNode(Element element, String tagName, String value) add Cdata Node if (value != null && !(value.equals(""))) { Document document = element.getOwnerDocument(); Element titleElement = document.createElement(tagName); titleElement.appendChild(document.createCDATASection(value)); element.appendChild(titleElement); |
String | addCDATAstring(String value) add CDAT Astring String CDATAvalue = value; if (!value.startsWith("<![CDATA[")) { CDATAvalue = "<![CDATA[" + value + "]]>"; return CDATAvalue.trim(); |
Element | addChildCdataElement(Node parent, String name, String cdata) add Child Cdata Element Element mElement = addChildElement(parent, name);
mElement.appendChild(mElement.getOwnerDocument().createCDATASection(cdata));
return mElement;
|
void | addNodeCDATAValue(Node node, String name, String value) add Node CDATA Value if (value != null) {
Document doc = node.getOwnerDocument();
Element e = doc.createElement(name);
e.appendChild(doc.createCDATASection(value));
node.appendChild(e);
|