1

When I include this line in my template for nodejs xmlbuilder2:

template = {
  'jcr:root': {
    ...
    '@xmlns:jcr': 'http://www.jcp.org/jcr/1.0', // this one
    ...
  }
}

I get the following error.

NamespaceError: The operation is not allowed by Namespaces in XML. [XMLNS] Qualified name includes a prefix but the namespace is null.

If I take it out, and paste "xmlns:jcr="..." in the xml file, and put it in AEM, it works (I should clarify, these are content fragments I'm making), but it does not show up in AEM without that line. I found this googling the error:

"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."

If I understand this right, my namespace URI is not null, and I am using xmlns:, so I need to change the uri to the right one? but this is the one that AEM has in its xml files when I download them.

I also think node doesn't like that 'xmlns:jcr' is an attribute of jcr:root, so it is defining jcr inside a jcr element, but again this is all copied verbatim from a file AEM made and I downloaded.

Kenzie
  • 131
  • 1
  • 3
  • Yes, it seems more like a bug from the `xmlbuilder2`. I see there is an open bug in GitHub, and it happens with other namespaces, so, in the meantime, you will have to workaround it. – ronnyfm Jul 22 '20 at 02:54

0 Answers0