Click here to Skip to main content
14,984,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert from clob to xml

C#
OCmd.Parameters.Add(":IN_REQUEST_OID", OracleDbType.Int64).Value = OID;
OCmd.Parameters.Add(":IN_CONTRACT_OID", OracleDbType.Int64).Value = ContractOID;
OCmd.Parameters.Add(":IN_CONTRACT_TYPE", OracleDbType.Varchar2).Value = ContractType;
OCmd.Parameters.Add(":OUT_INPUT_XML", OracleDbType.Clob, Input_XML, ParameterDirection.Output);
OCmd.Parameters.Add(":OUT_OUTPUT_XML", OracleDbType.Clob, Output_XML, ParameterDirection.Output);

OCmd.Connection.Open();
OCmd.ExecuteNonQuery();

DataSet ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add("INPUT");
ds.Tables[0].Columns.Add("OUTPUT");
ds.Tables[0].Columns.Add("SERVER_NAME");
DataRow dr = ds.Tables[0].NewRow();
ds.Tables[0].Rows.Add(dr);


I want to convert following obtained clob value into XML
Is it possible to typecast it into XML.

C#
ds.Tables[0].Rows[0]["INPUT"] =(Oracle.DataAccess.Types.OracleClob)OCmd.Parameters[3].Value).Value;
ds.Tables[0].Rows[0]["OUTPUT"] = ((Oracle.DataAccess.Types.OracleClob)OCmd.Parameters[4].Value).Value;
OCmd.Connection.Close();


[edit] Code tags added
Posted
Updated 21-Nov-11 21:55pm
v2

1 solution

Try casting the Oracle CLOB to .Net String and then load the String into XMLDocument.
http://www.code-magazine.com/article.aspx?quickid=0311071&page=3[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900