• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to insert brackets into an XML element value?

 
Ong CherYee
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Escape < with &lt; and > with &gt;
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can use a CDATA section.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic