When dealing with rdf:XMLLiteral's which includes HTML entities such as ’ does preference go to:

  • Including the Entities in a <!DOCTYPE section
  • Double encoding &amp;rsquo;
  • Converting the chars to plain Unicode characters of their numerical form. &#000;


asked 10 Jun '10, 14:43

Nathan's gravatar image

accept rate: 5%

I assume you ask how to write such entities in an RDF/XML document?

(10 Jun '10, 21:27) cygri ♦ cygri's gravatar image

To maximise portability, and that includes people round-tripping the data through different syntaxes and/or stores I'd recommend that you use the numeric forms in RDF/XML (and appropriate escaping in other syntaxes).

permanent link

answered 10 Jun '10, 15:48

ldodds's gravatar image

accept rate: 32%

So true. Don't expect characters outside of US-ASCII to live through many transitions from one to another system.

(10 Jun '10, 16:41) cygri ♦ cygri's gravatar image

good answer, cheers

(11 Jun '10, 16:15) Nathan Nathan's gravatar image

XML Literals are supposed to be in exclusive canonical form. If I read correctly that means you ought to do the following:

  • Use the literal character except...
  • in attribute values use &amp; &lt; &quot; &#x9; &#xA; and &#xD; for the relevant character.
  • in text content use &amp; &lt; &gt; &#xD;

So for &rsquo; you should enter '’', the character itself.

Serialisations other than rdf/xml may impose further restrictions. For example in N-Triples you must encode everything beyond US-ASCII, so <span>’</span> would be written as <span>\u2019</span>.

permanent link

answered 10 Jun '10, 21:09

Comment%20Bot's gravatar image

Comment Bot
accept rate: 42%


They are supposed to be in canonical form after parsing. This does in no way imply that they should be written in canonical form in RDF/XML. Canonicalization is the RDF/XML parser's job.

(10 Jun '10, 21:23) cygri ♦ cygri's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 Jun '10, 14:43

question was seen: 3,928 times

last updated: 10 Jun '10, 21:09