c# - Convert string to XML using .Net -
i store xml output string , again convert string xml .i convert xml output string, got problem again converting string xml.
sample code:
webservice.service1 objservice1 = new webservice.service1(); string s = objservice1.helloworld(); //convert xml output string xmldocument xd = new xmldocument(); xd.loadxml(s); i use loadxml() method, got error
data @ root level invalid. line 1 position 1. its grateful, if body give right code convert string xml in c#. thank you,
you should use xdocument. xdocument better xmldocument. efficient, simple , easy use.
your code :
webservice.service1 objservice1 = new webservice.service1(); string s = objservice1.helloworld(); //convert xml output string xmldocument xd = new xmldocument(); xd.loadxml(s); solution:
xdocument xd = xdocument.parse(s);
Comments
Post a Comment