Solved

Error is ORA-31011: XML parsing failed

Posted on 2008-10-05
1
2,040 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 27

Accepted Solution

by:
BigRat earned 500 total points
ID: 22668396
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to echo 6 117
delphi parse string to params 3 179
numbers ascending pyramid 101 265
Adjust the codes 3 64
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 …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

752 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