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="http://www.alfresco.org" xmlns:chiba="http://chiba.sourceforge.net/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:null="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/ProductApplication" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:application>Some Application</tns:application>
<tns:product>&lt;p&gt;Some Product&lt;/p&gt;</tns:product>
<tns:crossSellRank>1</tns:crossSellRank>
</tns:ProductApplication>

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.

Outcomes