From 4e439adb4ed23249c20dd062a17dc7091e318108 Mon Sep 17 00:00:00 2001
From: Stefan Bodewig In this documentation This means
+ * <a>
means an {@link
+ * org.w3c.do.Element Element} instance with name a
.createChildElement(<a>, "b")
+ * creates
+ *
+ * <a>
+ * <b/>
+ * </a>
+ *
+ * and returns <b>
.
This means + *
appendText(<a>, "b")+ * creates + *
+ * <a>b</a> + *+ * + * + * @param parent element that will receive the new element as child. + * @param content text content. + * + * @since Ant 1.6.3 + */ + public static void appendText(Element parent, String content) { + Document doc = parent.getOwnerDocument(); + Text t = doc.createTextNode(content); + parent.appendChild(t); + } + + /** + * Adds a nested CDATA section. + * + *
This means + *
appendCDATA(<a>, "b")+ * creates + *
+ * <a><[!CDATA[b]]></a> + *+ * + * + * @param parent element that will receive the new element as child. + * @param content text content. + * + * @since Ant 1.6.3 + */ + public static void appendCDATA(Element parent, String content) { + Document doc = parent.getOwnerDocument(); + CDATASection c = doc.createCDATASection(content); + parent.appendChild(c); + } + + /** + * Adds nested text in a new child element. + * + *
This means + *
appendTextElement(<a>, "b", "c")+ * creates + *
+ * <a> + * <b>c</b> + * </a> + *+ * + * + * @param parent element that will receive the new element as child. + * @param name of the child element. + * @param content text content. + * + * @since Ant 1.6.3 + */ + public static void appendTextElement(Element parent, String name, + String content) { + Element e = createChildElement(parent, name); + appendText(e, content); + } + + /** + * Adds a nested CDATA section in a new child element. + * + *
This means + *
appendCDATAElement(<a>, "b", "c")+ * creates + *
+ * <a> + * <b><![CDATA[c]]></b> + * </a> + *+ * + * + * + * @param parent element that will receive the new element as child. + * @param name of the child element. + * @param content text content. + * + * @since Ant 1.6.3 + */ + public static void appendCDATAElement(Element parent, String name, + String content) { + Element e = createChildElement(parent, name); + appendCDATA(e, content); + } +} \ No newline at end of file