Solved

Error is ORA-31011: XML parsing failed

Posted on 2008-10-05
1
2,032 Views
Last Modified: 2013-11-18
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>
****************************


0
Comment
Question by:rajsan1
1 Comment
 
LVL 27

Accepted Solution

by:
BigRat earned 500 total points
Comment Utility
Line 8 of the XSLT is incorrect. It should read </xsl:template> but actually reads <xsl:tempate>.
Line 12 is incorrect. It should read   <xsl:template match="msg"> but reads   <xsl:tempalte match="msg">
Lines 15 and 16 refer to a "text" element without any xsl prefix. I see no need for these elements anyway.

After I make those corrections the XSL compiles correctly.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
format the code in java 6 72
centeredAverage challenge 8 119
jQuery Date picker not working 16 71
JQuery tracking event. 3 38
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now