• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

escaping quotes

 
Trailboss
Posts: 22954
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you escape a quote in XML?
I want to pass this string:
Put an "f" on the end of floating literals.
And this needs to go into a tag attribute:
<explanation text="Put an "f" on the end of floating literals."/>
Obviously, the quotes need to be escaped. I tried a backslash, but that doesn't work.
 
paul wheaton
Trailboss
Posts: 22954
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer my own question, use " instead of "
But! Isn't there something a little more elegant without using a DTD?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you've been vicitmized by the UUB software here Paul. I'm guessing that what you tried to write was either &quot; or &#34;. Not elegant, but they should work.
 
paul wheaton
Trailboss
Posts: 22954
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to use &#34;
But you have led the way to the more elegant &quot;
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!