This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Replacing " with "

 
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am not able to write the " character as & quot; into the XML. Whereas, the other entities like < > and & and corresponding getting wriiten as & lt; & gt; and & amp;

I dont know why " is alone not getting expanded when written to the xml file.

Please Help..
I am caught with this problem for almost a day now...

NOTE: I have added a space between & and the rest of lt, gt and amp as I did not know how to overcome the escape of these entities
 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also attaching the code and sample file.



 
Sheriff
Posts: 28330
97
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
You're saying that the " character doesn't get escaped as &quot; in a text node? That's because it doesn't have to be escaped in a text node.

And you didn't explain why that's a problem that you have to solve.
 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The end product of the process is to translate the given XML file for specific nodes. So if there are any & quot; is present in the given node's value, then the code must not alter those entities. It must still be there. The end users would point on that.

Sample files we received from the customer has & quot; in the node's value.
 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there no way out to get the " in the text nodes...

Please Help..
 
Paul Clapham
Sheriff
Posts: 28330
97
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
Not with the standard parsers, no.

But note that your customer's alleged requirements are contrary to the XML Recommendation. They are trying to assign significance to a feature which is explicitly declared to be not significant in the Recommendation. Other non-significant choices include whether to surround attribute values with single or double quotes, whether to use CDATA sections for text nodes, and many others. So the data you are producing is (from the XML point of view) identical to the data you claim your customer is requiring, even though it looks different to humans. So your customer shouldn't really be complaining. It might turn out to be your job to explain this aspect of XML to the customer rather than trying to make cosmetic but non-significant changes to the documents which involve great development costs.
 
Oh the stink of it! Smell my tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic