Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to escape quotes in XML string data?

843834Nov 18 2002 — edited Nov 26 2006
Say I want to specify the company motto, "There's a sucker born every minute!" in my XML config file. As a Java string, it's easily represented as "\"There's a sucker born every minute!\""

But how do I do it in XML?
    <!-- Company motto
    -->
    <MOTTO value="There's a sucker born every minute!"/>
is valid XML, but the string doesn't include the beginning & ending quotes, as desired.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2006
Added on Nov 18 2002
6 comments
1,057 views