OracleClob to String conversion adds special characters. How to remove


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: OracleClob to String conversion adds special characters. How to remove

  1. #1
    Join Date
    Jan 2008
    Posts
    2

    OracleClob to String conversion adds special characters. How to remove

    Hi All,

    I have this code in my C#.NET project where I am getting a clob as output and converting into string.
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("p_XMLReport", OracleType.Clob).Direction = ParameterDirection.Output;
    cmd.Parameters.Add("p_FilterConditions", OracleType.Clob).Value = conditionList;
    cmd.Parameters.Add("p_ReportFields", OracleType.Clob).Value = fields;
    cmd.ExecuteNonQuery();
    OracleLob clob1 = ((OracleLob)cmd.Parameters.Value).Value.ToString();
    string _clob = System.Convert.ToString(clob1.Value);

    The string that is returned is as below...There is a backslash introduced around the attribute names.

    <DataSource>
    <DataRow>
    <column name = \"DEVELOPMENTSITE\">ADLK</column>
    <column name = \"ID\">3</column>
    <column name = \"PROJECTSTATUS\">Completed</column>
    <column name = \"PROJECTTYPE\">New Wafer</column>
    </DataRow>
    </DataSource>

    I further parse this string to add another attribute to each of the tags. I can successfully parse it and I see that the resultset has the attribute I wish to add.
    However, when I try to save it, it throws "Illegal characters in path" error. I am thinking this is because of the blackslashes. Is there a way to get rid of them ??

    resultset.LoadXml(_clob);
    XmlNodeList list = resultset.SelectNodes("//DataSource/DataRow/column");
    foreach (XmlNode node in list)
    {
    XmlAttribute newAttr = resultset.CreateAttribute("label");
    newAttr.Value = "Development Site";
    node.Attributes.Append(newAttr);
    }
    resultset.Save(_clob);

    Thanks,
    AD

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    How about using Regex with the Replace function and replacing the backslashes with ""
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. SQL DMO Restores in VB?
    By ObiWan in forum VB Classic
    Replies: 3
    Last Post: 05-23-2006, 11:35 AM
  2. Replies: 3
    Last Post: 10-03-2005, 12:57 AM
  3. Input string was not in a correct format
    By mdengler in forum ASP.NET
    Replies: 0
    Last Post: 11-26-2002, 03:32 PM
  4. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 06:23 AM
  5. Replies: 4
    Last Post: 04-23-2002, 11:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center