4

Can XML, xml, xML or any variation of upper and lowercase versions of "xml" be used as element or attribute names in xml?

If not why not?

Edit1

I am referring to naming elements or attributes. Not doctype

Edit2

I am not suggesting this would be a good name for an element or attribute, I could not find a definitive answer for this.

  • Does this help? http://stackoverflow.com/questions/7414747/is-xml-case-sensitive – HAL Aug 16 '13 at 11:01
  • I'd say yes - you can use any word you want, but I wouldn't recommend using xml as attribute or element name – Roman Pekar Aug 16 '13 at 11:07
  • 1
    @Skippy Good question Skippy. Personally I would say "Hey, if they're letters and they all spell out `X-M-L` and that doesn't stand for "X-Large, Medium, Large", then I say why not? You can always implement an `strtolower` or `strtoupper` function if needed to convert the `xMl` string to upper or lowercase. We have the power ;) – Funk Forty Niner Aug 16 '13 at 11:56
  • 1
    @Skippy You could say... used to be in a trade where clothing was part of the line... "clothes line" that is ;) – Funk Forty Niner Aug 16 '13 at 12:11
  • 1
    @Skippy Yeah but the smell of clothes on a clothes line in Spring, cannot be beat! Aahhh Ireland, where art though now? – Funk Forty Niner Aug 16 '13 at 12:14
  • 1
    @Skippy Not though......... but "thy"? Mine Olde English is a bit roosty! – Funk Forty Niner Aug 16 '13 at 12:26

3 Answers3

6

While most tools probably don't prevent it, it's probably a bad practice. According to http://www.w3.org/TR/xml/#NT-Name

Names beginning with the string "xml", or with any string which would match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for standardization in this or future versions of this specification.

ie, it might work now...

MattR
  • 6,908
  • 2
  • 21
  • 30
5

Although it's not prohibited, take a look at the Suggestions for XML Names (Non-Normative):

Names which are nonsensical, unpronounceable, hard to read, or easily confusable with other names should not be employed.

Alex Filipovici
  • 31,789
  • 6
  • 54
  • 78
4

XML format's definition does not prohibit it: http://www.w3.org/TR/xml/#NT-Name

You can check it here: http://www.w3schools.com/xml/xml_validator.asp - even "xml" tags validate without errors.

BartoszKP
  • 34,786
  • 15
  • 102
  • 130