ORA-31011: XML parsing failed for AL32UTF8
kogotok1Sep 30 2004 — edited May 12 2006Hi,
Oracle 9.2.0.5
ODP 9.2.0.4
.NET Framework 1.1
Database charset - AL32UTF8.
Oracle NET Clent has nls_lang CL8MSWIN1251.
Stored Procedure constructs one XmlType.
C# program gets OracleXmlType from stored procedure
and converts it to .NET XmlDocument or prints
into console.
When program runs against database with charset WIN1251,
it works OK.
When program runs against database with charset AL32UTF8
or UTF8, it raises an exception
Oracle.DataAccess.Client.OracleException
ORA-31011: XML parsing failed .
while converting OracleXmlType to
.NET XmlDocument or while try to print it to Console.
XML is very simple:
SELECT sys.xmltype.createxml('<sd/>') INTO xmlvar FROM dual;
I avoid this exception using not very honest (from
my point of view) thing: at the end of stored procedure
I perform
xmlvar:=sys.xmltype.createxml(xmlvar.getstringval());
As far as I understand, getstringval() gets 32K only,
but I need XMLType with 2Gb-length. I tryed to change getstringval to getclobval, but, unfortunately,
getclobval() gets ORA-31011 too.
What can be the reason ?
Please, give me a piece of advise.
Piece of C# code:
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GET_XML"; //name of stored procedure
OracleParameter p1 = new OracleParameter();
p1.OracleDbType = OracleDbType.XmlType;
p1.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p1);
cmd.Connection = con;
cmd.ExecuteNonQuery();
OracleXmlType otype = (OracleXmlType)p1.Value;
XmlDocument xdoc = otype.GetXmlDocument();
Thanks
Viacheslav