Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Special Characters in XML

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?

like image 990
BillZ Avatar asked Oct 16 '08 15:10

BillZ


People also ask

Are special characters allowed in XML?

The only illegal characters are & , < and > (as well as " or ' in attributes, depending on which character is used to delimit the attribute value: attr="must use &quot; here, ' is allowed" and attr='must use &apos; here, " is allowed' ). They're escaped using XML entities, in this case you want &amp; for & .

How do I find special characters in XML?

Open an XML document in the text editing mode, right click inside it and there is a new menu item "Determine Complex Layout Chars".

How does XML support special characters?

To include special characters inside XML files you must use the numeric character reference instead of that character. The numeric character reference must be UTF-8 because the supported encoding for XML files is defined in the prolog as encoding="UTF-8" and should not be changed.

How do I change special characters in XML?

Answer. Special characters (such as <, >, &, ", and ' ) can be replaced in XML documents with their html entities using the DocumentKeywordReplace service. However, since html entities used within BPML are converted to the appropriate character, the string mode of DocumentKeywordReplace will not work in this instance.


1 Answers

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 &raquo; you should use &#187;

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.

»
like image 166
Joe Lencioni Avatar answered Oct 22 '22 19:10

Joe Lencioni