In this tutorial, you will see the use of append(String str) method of CDATA class.
In this tutorial, you will see the use of append(String str) method of CDATA class.
In this tutorial, we will implement append() method of CDATA class. The
CDATA class is available
in org.jdom package. The append(
java.lang.String string) method will append character data
with
in this CDATA node.
In this example, we can create a CDATA node with the help CDATA class. The CDATA(java.lang.String string) constructor of CDATA class crates a CDATA new node with a string.
The setContent(Content content ) method of Element class is used to set the content at element.
Book.xml
<?xml version="1.0" encoding="UTF-8"?>
|
AppendCdata
.java
package roseindia;
|
<?xml version="1.0" encoding="UTF-8"?>
<BookCatalog> <book name="java"> <![CDATA[<Detail>java is a programming book.</Detail>.It support oops concept.]]></book> <book name="c" /> </BookCatalog> Charater data : <Detail>java is a programming book.</Detail>.It support oops concept. |