• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

insert '&' into the XML text data?

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I want to insert the & in the text data of a xml elment. This is referece to my last post.
It is inserted as & in the text data .

Please help.
 
Sheriff
Posts: 28368
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abhijit Das wrote:hi,
I want to insert the & in the text data of a xml elment. This is referece to my last post.


You can edit your posts, you know. But let me close that one, since you now have a new post.


It is inserted as & in the text data .

Please help.


Yes, that's how it is supposed to work. Read about "escaping", it should be near the beginning of your XML book. Why do you consider it to be a problem?
 
Abhijit Das
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I am inserting using JAVA APIs.
for example,
String str = "Jhon & Paul";

The the String varaible to be inserted into XML file in an element , say,
<names> </names>

I am inserting using XML perser using JAVA APIs.

so, It is inserted as
<names> Jhon & amp; amp; Paul</name>

Note: ignore the space between & and amp;

If i use CDATA , then teh actual text is coming but CDATA. is also there.

Thanks.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic