asp.net mvc - Converting string of XML with <?xml version="1.0"?> in it to XML -


i having issues converting string xml.string in format

 string s = "<?xml version="1.0"?><brands><brand><brandid>1</brandid><brandname>abc</brandname></brand><brand><brandid>2</brandid><brandname>def</brandname></brand></brands>"; 

the above string comes webservice response.

the main problem when have string <?xml version="1.0"?> gives error "; expected" because of xml header "1.0". rest of code have figured out convert xml , all.it doesn't compile can go further.

 xmldocument doc = new xmldocument();  doc.loadxml(s); 

you can escape " \". like:

string s = "<?xml version=\"1.0\"?><brands>..." 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -