【发布时间】:2015-09-04 09:41:23
【问题描述】:
我正在尝试将 HTML 存储为带有空标签的 XML 格式:
<body xmlns="http://www.w3.org/1999/xhtml">
<div class="WordSection1" xmlns="">
<p class="ChapterNumber">Chapter 6</p>
<h1 class="ChapterTitle">The Legislature and the <br/>Electoral System</h1>
<p class="ChapterSub-Title"> </p>
<div style=""></div>
</div>
</body>
在 MarkLogic 中存储后,我得到空的自闭合标签
<body xmlns="http://www.w3.org/1999/xhtml">
<div class="WordSection1" xmlns="">
<p class="ChapterNumber">Chapter 6</p>
<h1 class="ChapterTitle">The Legislature and the <br />Electoral System</h1>
<p class="ChapterSub-Title"> </p>
<div style="" />
</div>
</body>
它生成了无效的 XHTML。如何获取原始 XML,无论是自闭合元素还是空元素,因为它是原始文件?
【问题讨论】:
-
它们在语义上是相同的,为什么会出现这样的问题?
-
感谢您的即时回复,您的意思是“语义相同”?
-
就 XML 规范而言意思相同。
-
谢谢 Sobrique,我找到了问题,xmlns="",空的命名空间更改为无效的 xhtml
-
很高兴您发现了这个问题。只是为了清楚起见 - MarkLogic 不存储您的 XML。它以内部格式存储文档——本质上是逐个节点。返回的内容是即时生成的,并不一定代表“确切”您开始摄取的内容。