AnsweredAssumed Answered

Error Processing XML Content with the JavaScript API

Question asked by stevewickii on Nov 2, 2008
Latest reply on Jun 13, 2014 by valfontanette
RhinoScript supports ECMAscript for XML (E4X).  I created a document under Company Home using DM Forms (XForms and an XML Schema definition for ProductApplication).  In the JavaScript file for my Web Script I am trying to select Documents under Company Home that are of type text/xml and have an element within the node's XML content set to "Some Application".

I am getting an error when I try to parse the content into an XML object with this statement: var doc = new XML(node.content);

The error I get is:  org.mozilla.javascript.EcmaError - TypeError: Cannot parse XML: The processing instruction target matching "[xX][mM][lL]" is not allowed. (AlfrescoScript#14)

node.content is:
<?xml version="1.0" encoding="UTF-8"?>
<tns:ProductApplication xmlns:alf="" xmlns:chiba="" xmlns:ev="" xmlns:null="" xmlns:tns="" xmlns:xf="" xmlns:xhtml="" xmlns:xsi="">
<tns:application>Some Application</tns:application>
<tns:product>&lt;p&gt;Some Product&lt;/p&gt;</tns:product>

If I remove the processing-instruction <?xml …?> it works fine.  I don't want to code around this problem.  I set XML.ignoreProcessingInstructions=true, but it still fails to execute with the same error.

I am using Alfresco Community 2.9B with the out-of-the-box configuration.