xml namespace issues when building an xml file in nodejs xmlbuilder2

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.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.