This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 42958
    
  73
Or you can use a CDATA section.
 
 
subject: How to insert brackets into an XML element value?
 
jQuery in Action, 3rd edition