aspose file tools
The moose likes XML and Related Technologies and the fly likes Special character in CDATA Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Special character in CDATA" Watch "Special character in CDATA" New topic
Author

Special character in CDATA

Ian Craig
Greenhorn

Joined: Nov 30, 2012
Posts: 1
I'm trying to render a trademark symbol within this CDATA tag within an XML document ( I'm using: <?xml version="1.0" encoding="UTF-8"?> )

<head><![CDATA[Product name ™]]> </head>

It just gets rendered as Product name ™

Any help greatly appreciated!


Thanks....

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

Well, that looks perfectly fine to me the way you posted it.

But perhaps you were trying to say that you used the HTML named entity &trade;? (If you're going to post HTML entities, you have to escape them properly.)

In any case, your document is encoded in UTF-8. So either put the character itself into the document, encoded in UTF-8, or use a character entity like &#x2122;. And by the way it doesn't make any difference that it's inside a CDATA section, the same character rules apply there as for everywhere else in the document.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Special character in CDATA
 
Similar Threads
XPathAPI.selectSingleNode going up the document on cached element
using javascript in xsl
CDATA Whitespace issue
org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element '
Help me with a Simple HelloWorld.jsp