views:

25

answers:

1

I need to represent special characters like superscripts, copyright symbols etc in XML. What's the best way to do this?

I'm confused as XML defines 5 entity references for "<" , ">" etc. I always use < and > but could, or should, I use Unicode decimal, U+003C, instead? Or will an XML processor treat these the same as if I'd typed "<" and error as it's a reserved character?

For non-reserved characters, eg the copyright symbol, is it enough to insert the Unicode (U+00A9) into the XML or should I define an entity reference in my Schema?

Thanks ;-)

+1  A: 

I'm confused as XML defines 5 entity references for "<" , ">" etc. I always use < and > but could, or should, I use Unicode decimal, U+003C, instead? Or will an XML processor treat these the same as if I'd typed "<" and error as it's a reserved character?

A raw < would be an error (since it means "Start of tag").

For non-reserved characters, eg the copyright symbol, is it enough to insert the Unicode (U+00A9) into the XML or should I define an entity reference in my Schema?

Using the actual character is fine (and generally preferred to using an entity as it is more readable (and takes marginally fewer bytes).

David Dorward