Link to home
Start Free TrialLog in
Avatar of rajsan1
rajsan1

asked on

Error is ORA-31011: XML parsing failed

Hello,  Please help me to solve this problem.....
The following PLSQL code works fine in Oracle 9i for transforming xsl document to xml
We have upgrade to 10g and then onwards we get the following error.
****************Error is ORA-31011: XML parsing failed******************

The PLSQL code is
***********************
 FUNCTION transform (
      SOURCE           xmldom.domdocument,
      style            dbms_xslprocessor.stylesheet,
      params           paramlist := NONE,
      debug_on         BOOLEAN := FALSE,
      debug_with_xml   BOOLEAN := TRUE
   )
     
        RETURN CLOB IS
          engine   dbms_xslprocessor.processor := dbms_xslprocessor.newprocessor;
                OUT CLOB;
         xmldoc1 CLOB;
xslelem xmldom.DOMElement;
nspace varchar2(50);
xslcmds xmldom.DOMNodeList;

   BEGIN
      setparams (style, params, debug_on);
        dbms_lob.createtemporary(OUT,false);
      dbms_xmldom.writetoCLOB(SOURCE,xmldoc1);
   xslelem := xmldom.getDocumentElement(source);
   nspace := xmldom.getNamespace(xslelem);
      DBMS_xslprocessor.processxsl (engine, style, SOURCE, OUT);
     dbms_xslprocessor.freeprocessor (engine);
      RETURN OUT;
   EXCEPTION
      WHEN OTHERS THEN
          impact_xml_utility.process_message ('ERROR in xlsprocessor : ');
          dbms_output.put_line('Error is ' ||SQLERRM);
         dbms_xslprocessor.freeprocessor (engine);
         RAISE;
   END;
*******************************demomerge.xsl document********************
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
     <xsl:variable name="doc2" select="document('file:///opt/simpact/Connector/Vendors/demo2.xml')"/>
     <xsl:template match="@*|node()">
         <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
          </xsl:copy>
       <xsl:tempate>

  <xsl:tempalte match="msg">
    <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
         <text><xsl:value-of select="$doc2/messages/msg[key=current()/key]/text"/>
     </text>
 </xsl:copy>
</xsl:template>
</xsl:stylesheet>
************************************
**********************demo1.xml*******************
<messages>
   <msg>
     <key>AAA</key>
     <num>01001</num>
  <msg>
    <msg>
     <key>bbb</key>
     <num>01011</num>
  <msg>
</messages>
***************************************
******************************demo2.xml*****************
<messages>
   <msg>
     <key>AAA</key>
     <text>This is a Message</text>
  <msg>
    <msg>
     <key>bbb</key>
     <text>This is another Message</text>
  <msg>
</messages>
****************************


ASKER CERTIFIED SOLUTION
Avatar of BigRat
BigRat
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial