Solved

Error is ORA-31011: XML parsing failed

Posted on 2008-10-05
1
2,039 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 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