< tag /&gt之间是否存在语义差异;和< tag></tag> gt;在xml中?
我们对客户有某种问题,认为我们要发送的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有
start-tag/end-tag(
&lt; tag&gt;&lt;/tag&gt;
)和空元素标签(&lt; tag/&gt;
)表单是语义上等效的。 不符合XML解析器会以不同的方式对待它们。参考:
“ noreferrer”>可扩展的标记语言(xml)1.0(第五版)
3.1 start-tags,end-tag,end-tag和eytem-element element标签 P>
for空元素
历史注:也有一个过时的SGML兼容性参考,我包括完整性:
1.2术语
相关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)
3.1 Start-Tags, End-Tags, and Empty-Element Tags
Tags for Empty Elements
Historical note: There is also an antiquated SGML compatibility reference, which I include for completeness:
1.2 Terminology
Related Q/A: