Special Characters in XML

BillZ picture BillZ · Oct 16, 2008 · Viewed 17.6k times · Source

I am creating a left navigation system utilizing xml and xsl. Everything was been going great until I tried to use a special character in my xml document. I am using » and I get th error.

reason: Reference to undefined entity 'raquo'.
error code: -1072898046

How do I make this work?

Answer

Joe Lencioni picture Joe Lencioni · Oct 16, 2008

You are trying to use an HTML entity in a non-HTML or non-XHTML document. These entities are declared in the document's Document Type Definition (DTD).

You should use the numerical Unicode version of the entity reference. For example, in the case of » you should use »

Alternatively, you can define them in your XML document's DTD:

<!ENTITY entity-name "entity-value">
<!ENTITY raquo "&#187;">

Otherwise, if your document is UTF-8, I believe you can just use the actual character directly in your XML document.

»