Is there a semantical difference between and in XML?

前端 未结 1 1552
深忆病人
深忆病人 2021-01-03 09:29

We have some kind of problem with a customer which is arguing that there is a semantical difference between two versions of empty tag in an XML file we\'re sending (pure XML

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 10:28

    No

    Start-tag/End-tag () and Empty-element tag () forms are semantically equivalent. No conforming XML parser will treat them differently.


    Reference: Extensible Markup Language (XML) 1.0 (Fifth Edition)

    • 3.1 Start-Tags, End-Tags, and Empty-Element Tags

      • Tags for Empty Elements

        Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword EMPTY.


    Historical note: There is also an antiquated SGML compatibility reference, which I include for completeness:

    For interoperability, the empty-element tag should be used, and should only be used, for elements which are declared EMPTY.

    • 1.2 Terminology

      for interoperability

      [Definition: Marks a sentence describing a non-binding recommendation included to increase the chances that XML documents can be processed by the existing installed base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879.]


    Related Q/A:

    • Self-closing tags in XML files
    • Create XML element without closing tag
    • Is XML's root closing tag mandatory?
    • XML with end tag and without it (self-closing tag)
    • What does mean in XML?

    0 讨论(0)
提交回复
热议问题