当我在我的 nodejs xmlbuilder2 模板中包含这一行时:
template = {
'jcr:root': {
...
'@xmlns:jcr': 'http://www.jcp.org/jcr/1.0', // this one
...
}
}
我收到以下错误。
NamespaceError: The operation is not allowed by Namespaces in XML. [XMLNS] Qualified name includes a prefix but the namespace is null.
如果我将其取出,并将“xmlns:jcr="..." 粘贴到 xml 文件中,然后将其放入 AEM,它可以工作(我应该澄清一下,这些是我正在制作的内容片段),但它没有没有那条线出现在AEM中.我发现这个谷歌搜索错误:
"if the qualified name includes a prefix, the namespace URI cannot be null or an empty string. if the reserved xmlns prefix is used, the namespace URI must match the corresponding specified system URI."
如果我理解正确,我的命名空间 URI 不为空,并且我使用的是 xmlns:,所以我需要将 uri 更改为正确的吗?但这是我下载它们时 AEM 在其 xml 文件中的一个。
我也认为节点不喜欢'xmlns:jcr'是jcr:root的一个属性,所以它在jcr元素中定义jcr,但这又是从我下载的AEM文件中逐字复制的。