You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by kathiresan jeyapandian <j_...@yahoo.co.in> on 2006/07/13 15:09:24 UTC

XML Strings with special Characters

Hi All,
   
         I am trying to set the string content of an element.
         I simply do parentName.setName("kathir&"); 
         The problem is that the string contains ampersands (&). In the xml i am getting & instead of getting &amp;
         I need to get the output xml with & as &amp;
   
  Please help me.
  Thanks,
J.Kathir
   

 				
---------------------------------
 Find out what India is talking about on  Yahoo! Answers India.
 So, whatÂ’s NEW about the NEW Yahoo! Messenger? Find out.

RE: XML Strings with special Characters

Posted by "Lewis, David" <dl...@pfc.cfs.nrcan.gc.ca>.
The easiest way to set Strings containing "special characters" that you
do not want parsed is to wrap them in a CDATA section:

http://www.w3.org/TR/xml11/#dt-cdsection

 

The solution for your example would be:

parentName.setName("<![CDATA[kathir&]]>");

 

Cheers,

 

~ David

  _____  

From: kathiresan jeyapandian [mailto:j_kathiresan@yahoo.co.in] 
Sent: July 13, 2006 6:09 AM
To: j_kathiresan@yahoo.co.in
Subject: XML Strings with special Characters

 

Hi All,

 

       I am trying to set the string content of an element.

       I simply do parentName.setName("kathir&"); 

       The problem is that the string contains ampersands (&). In the
xml i am getting & instead of getting &amp;

       I need to get the output xml with & as &amp;

 

Please help me.

Thanks,
J.Kathir

 

  

  _____  


Find out what India is talking about on Yahoo!
<http://us.rd.yahoo.com/mail/in/mailanswersshare/*http:/in.answers.yahoo
.com/>  Answers India.
So, what's NEW about the NEW Yahoo! Messenger? Find
<http://us.rd.yahoo.com/mail/in/mailmessenger/*http:/in.beta.messenger.y
ahoo.com/>  out.