tags:

views:

57

answers:

2
<XmlInfo />

I ran into problem using Perl's popular SOAP::Lite module, where it wouldn't accept XML entity names starting with "xml" (regardles letters' case). The author of the module replied to email saying that entity names starting with "xml" are not permitted in XML specification, but I couldn't find it in W3C's documents for 1.0 and 1.1 specs, I also couldn't find it in any of the articles or guidelines docs about XML entity naming. In fact some guideline documents used names starting with xml as an example, and lots of people are using it, as I see via Google Code Search.

So are there any restrictions (besides which characters to use as defined in W3C's documents) in Entity naming in XML? Is there a restriction saying you can't name entities starting with "xml"?

+4  A: 

This link: http://www.exforsys.com/tutorials/xml/xml-elements-attributes-entities.html provides the answer:

  1. XML Names must begin with one of: letter, underscore, colon, valid name characters including the preceding plus digits, hyphens or full stops.
  2. The colon character should not be used, except as a namespace delimiter
  3. XML naming conventions is not limited to ASCII characters and ideographic characters could be used.
  4. It may not begin with the string “xml”,”XML”, or any match of these characters

Number 4 is what you're looking.

AndyC
Thank you! But where does this coming from?! I don't see this in the XML specs :(
flamey
nm, i found it here http://www.w3.org/TR/2008/REC-xml-20081126/#sec-common-syn
flamey
+1  A: 

I found one mention of it in HTML & XML, The Definitive Guide, under "15.3.3. Entity Declarations":

The only restriction is that names may not begin with the sequence "xml" (either upper or lowercase).

Hans Kesting