Well formed XML? XML references within tag names and attribute names

后端 未结 3 770
没有蜡笔的小新
没有蜡笔的小新 2021-01-19 08:24

I have been searching trying to confirm my reading of the XML spec. My interpretation is that pre-defined entities and numeric character references are not allowed in tag n

3条回答
  •  青春惊慌失措
    2021-01-19 08:38

    It seems to me that they are both wrong. According to the spec, only the following characters should be in a start tag:

    ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
    

    XMLSpy certainly isn't happy with it either. Nor .

    And...just for good measure...here's what .NET had to say about it:

    The '&' character, hexadecimal value 0x26, cannot be included in a name. Line 1, position 12.
    

    What parsers are you using?

提交回复
热议问题