This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to insert  brackets into an XML element value? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to insert  brackets into an XML element value?" Watch "How to insert  brackets into an XML element value?" New topic
Author

How to insert brackets into an XML element value?

Ong CherYee
Greenhorn

Joined: Jan 17, 2008
Posts: 11
If I have a <file> </file> element in an XML file and I want to insert a filename of the form PED<yyMMdd>232, how do I insert the < and > brackets as an element value inside the <file> tag?

I use JCreator to edit the xml file and it treats <yyMMdd> as a seperate element instead of being part of the filename.

Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Escape < with &lt; and > with &gt;


apigee, a better way to API!
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
Or you can use a CDATA section.
 
wood burning stoves
 
subject: How to insert brackets into an XML element value?