< tag /&gt之间是否存在语义差异;和< tag></tag> gt;在xml中?

发布于 2025-02-12 09:32:10 字数 562 浏览 3 评论 0原文

我们对客户有某种问题,认为我们要发送的XML文件中两个版本的空标签之间存在语义差异(纯XML no html ..)。

他们期望:

 <our-xml>
    <some-tag></some-tag>
 </our-xml>

我们发送:

 <our-xml>
    <some-tag />
 </our-xml>

我们认为这是完全一样的,但我们无法真正证明事实的论点。我们唯一发现的是 https://www.w3.org/tr/ rec-xml/#sec-starttags 在哪里说

空元素标签可用于任何没有内容的元素。

是否有我们可以依靠的讨论或更清晰的论文,或者我们错了?

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 no HTML..).

They expect:

 <our-xml>
    <some-tag></some-tag>
 </our-xml>

We send:

 <our-xml>
    <some-tag />
 </our-xml>

We are of the opinion that this is exactly the same but we could not really prove the arguments with facts. Only thing we found was in https://www.w3.org/TR/REC-xml/#sec-starttags where it says

empty-element tags may be used for any element which has no content.

Is there any discussion or more clear paper that we can rely on or are we wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合约呢 2025-02-19 09:32:12

没有

start-tag/end-tag(&lt; tag&gt;&lt;/tag&gt;)和空元素标签(&lt; tag/&gt;)表单是语义上等效的。 不符合XML解析器会以不同的方式对待它们。


参考
“ noreferrer”>可扩展的标记语言(xml)1.0(第五版)


历史注:也有一个过时的SGML兼容性参考,我包括完整性:

用于互操作性,应使用空元素标签,仅应使用为空声称的元素。

  • 1.2术语

    用于互操作性

    [定义:标记一个句子,描述了一个句子,该句子包含了一个非约束建议,以增加XML文档可以通过SGML处理器的现有安装基础来处理的机会,该基础的sgml处理器的现有基础早于ISO 8879。]


相关Q/A:

No

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


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


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:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文