How do I convert JDOM Document to String?

This example demonstrate how to convert JDOM Document object to a String using the XMLOutputter.outputString(Document doc) method.

How do I get mixed content of an xml element?

The following examples demonstrate how to read mixed content of an xml element. A mixed content can have more than one type of content such as text (Text), comment (Comment), CDATA (CDATA) or some child elements (Element).

You also see that we can remove the mixed content from the element by calling the remove method of the List just like what we do with a collection of data.

Here are the result of our program:

How do I build xml CDATA sections?

This example demonstrate how to add CDATA section into an xml document. A CDATA section indicates a block that shouldn’t be parsed. To build a CDATA section just wrap the string with a CDATA object.