XmlElement to string

Results 1 to 2 of 2

Thread: XmlElement to string

  1. #1
    Join Date
    Dec 1969

    Default XmlElement to string

    Hello,<BR>I ve got a web service that accepts XmlElement as an input parameter.<BR>Then within my web method i would like to convert it to sting and then pass the string to my the stored procedure and use OPENXML to insert the values to SQL Server.<BR>[WebMethod]<BR>public string StoreBooking([XmlAnyElement]XmlElement booking)<BR>{<BR> XmlDocument doc = new XmlDocument();<BR> StringWriter sw = new StringWriter();<BR> try<BR> {<BR> doc.AppendChild(booking);<BR> XmlTextWriter xw = new XmlTextWriter(sw);<BR> doc.WriteTo(xw);<BR> }<BR><BR> catch (XmlException e)<BR> {<BR> return e.ToString();<BR> }<BR> return doc.ToString();<BR><BR>But for some reason i cant add the XmlElement to the XmlDocument.<BR>Please help me<BR>Thanks in advanse.

  2. #2

    Default RE: XmlElement to string

    What kind of exception does it throw?<BR>Does it work if you call it directly (not as a webmethod)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts