Is a colon a legal first character in an XML tag name?

前端 未结 2 1951
心在旅途
心在旅途 2020-12-11 21:57

According to the W3C XML Recommendation, start tag-names have the definition:

STag ::= \'<\' Name (S Attribute)* S? \'>\'

..where

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-11 22:14

    They are allowed in non-namespace-aware XML but they are not allowed in namespace-aware XML. More specifically, the base XML recommendation allows them but the Namespaces recommendation prohibits them. Very few people nowadays use non-namespace-aware XML (and I'm not sure what parsers support it) so it's best to assume they aren't allowed.

提交回复
热议问题