• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to have HTML entities in a XML element

 
Greenhorn
Posts: 16
jQuery AngularJS Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have been using XMLBeans for parsing xml documents. It works fine but when i have HTML entities like ® © there is a parsing error in the document. I tried to modify the type of the element to CDATA but then the HTML entities are changed and & is replaced with & so it doesn't render right on the page.



This is error which i have been getting org.apache.xmlbeans.XmlException: org.xml.sax.SAXParseException: The entity "reg" was referenced, but not declared.

Thanks
Srikkanth
 
Marshal
Posts: 28177
95
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
XML knows nothing about HTML entities, so by using them, you make the document not well-formed.

Your best option is to not use them. Instead, use the corresponding XML character entities. Another alternative is to provide the document with a DTD which defines all of the entities you plan to use. But really I think it's better not to speak XML with an HTML accent.
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic