• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

XSD type: CDATA

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following code:

<xsd:element name="approvalDesc" nillable="true"
type="xsd:string" maxOccurs="1" minOccurs="0">
</xsd:element>

I want the data in approvalDesc to come as CDATA as it may contain special chars which may crack XML.
 
Marshal
Posts: 27214
87
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
I don't believe you can require a text node to be a CDATA section. Anyway your concern is misplaced because CDATA is never a requirement; it's always possible to escape text according to the standard XML rules instead.
 
Ankur Kumar Gautam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I m trying to enter some special characters in approvDesc but its giving error....
-----invalid XML characters----------
 
Paul Clapham
Marshal
Posts: 27214
87
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
That's the actual error message?

At any rate if the "you" in that question is you plus a text editor, then you aren't doing it right. Or if you're using standard Java I/O classes to output XML, then you aren't doing it right either. If I knew what you meant by "special characters", and what you were doing for them, I might be able to suggest a change. But I will just suggest you read the section in your XML book about escaping. It's most likely near the beginning of the book.
 
get schwifty. tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic