Java Code Examples for org.dom4j.Element.addCDATA()

The following are Jave code examples for showing how to use addCDATA() of the org.dom4j.Element class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: minlia-iot   File: AbstractAnnotationApiSerializer.java   View Source Code Vote up 5 votes
/**
 * 添加节点
 */
private void addElement(Element rootElement, String elementName, Object obj, boolean required) {
  if (obj == null && !required) {
    return;
  }
  Assert.notNull(obj, elementName);
  Class<?> clazz = obj.getClass();
  Element element = rootElement.addElement(elementName);
  if (clazz == Integer.class || clazz == Long.class) {
    element.setText(obj.toString());
  } else {
    element.addCDATA(obj.toString());
  }
}
 
Example 2
Project: parabuild-ci   File: Dom4JXMLOutput.java   View Source Code Vote up 4 votes
public void writeCDATA(String cdata) {
	Element top = (Element) stack.getLast();
	top.addCDATA(cdata);
}