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.styleshe et,
params paramlist := NONE,
debug_on BOOLEAN := FALSE,
debug_with_xml BOOLEAN := TRUE
)
RETURN CLOB IS
engine dbms_xslprocessor.processo r := dbms_xslprocessor.newproce ssor;
OUT CLOB;
xmldoc1 CLOB;
xslelem xmldom.DOMElement;
nspace varchar2(50);
xslcmds xmldom.DOMNodeList;
BEGIN
setparams (style, params, debug_on);
dbms_lob.createtemporary(O UT,false);
dbms_xmldom.writetoCLOB(SO URCE,xmldo c1);
xslelem := xmldom.getDocumentElement( source);
nspace := xmldom.getNamespace(xslele m);
DBMS_xslprocessor.processx sl (engine, style, SOURCE, OUT);
dbms_xslprocessor.freeproc essor (engine);
RETURN OUT;
EXCEPTION
WHEN OTHERS THEN
impact_xml_utility.process _message ('ERROR in xlsprocessor : ');
dbms_output.put_line('Erro r is ' ||SQLERRM);
dbms_xslprocessor.freeproc essor (engine);
RAISE;
END;
************************** *****demom erge.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/simpac t/Connecto r/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=curre nt()/key]/ text"/>
</text>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
************************** **********
**********************demo 1.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>
************************** **
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.styleshe
params paramlist := NONE,
debug_on BOOLEAN := FALSE,
debug_with_xml BOOLEAN := TRUE
)
RETURN CLOB IS
engine dbms_xslprocessor.processo
OUT CLOB;
xmldoc1 CLOB;
xslelem xmldom.DOMElement;
nspace varchar2(50);
xslcmds xmldom.DOMNodeList;
BEGIN
setparams (style, params, debug_on);
dbms_lob.createtemporary(O
dbms_xmldom.writetoCLOB(SO
xslelem := xmldom.getDocumentElement(
nspace := xmldom.getNamespace(xslele
DBMS_xslprocessor.processx
dbms_xslprocessor.freeproc
RETURN OUT;
EXCEPTION
WHEN OTHERS THEN
impact_xml_utility.process
dbms_output.put_line('Erro
dbms_xslprocessor.freeproc
RAISE;
END;
**************************
<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:///
<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
</text>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
**************************
**********************demo
<messages>
<msg>
<key>AAA</key>
<num>01001</num>
<msg>
<msg>
<key>bbb</key>
<num>01011</num>
<msg>
</messages>
**************************
**************************
<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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.