convert string to datatable

H

Hemant

Hi,

I have a string it contain following string .

<taSopLineIvcInsert><SOPTYPE>2</SOPTYPE><SOPNUMBE>123456
</SOPNUMBE><CUSTNMBR>345</CUSTNMBR><DOCDATE>10/10/2009</DOCDATE><ITEMNMBR>2342</ITEMNMBR><UNITPRCE>5.20</UNITPRCE><XTNDPRCE>10.40</XTNDPRCE><QUANTITY>2.000</QUANTITY><ITEMDESC>Story
Book</ITEMDESC><TAXAMNT>0.81</TAXAMNT><LNITMSEQ>2343</LNITMSEQ></taSopLineIvcInsert>

i want to select this string and want to show this in csv file . for this i
and doing string manuplation and find this substring and than add this to a
xml file and that converting this xml file to table and than showing the
data in csv file.

Is there another easy method?

Thanks,

Hemant
 
A

Alexey Smirnov

Hi,

I have a string it contain following string .

<taSopLineIvcInsert><SOPTYPE>2</SOPTYPE><SOPNUMBE>123456
</SOPNUMBE><CUSTNMBR>345</CUSTNMBR><DOCDATE>10/10/2009</DOCDATE><ITEMNMBR>2­342</ITEMNMBR><UNITPRCE>5.20</UNITPRCE><XTNDPRCE>10.40</XTNDPRCE><QUANTITY>­2.000</QUANTITY><ITEMDESC>Story
Book</ITEMDESC><TAXAMNT>0.81</TAXAMNT><LNITMSEQ>2343</LNITMSEQ></taSopLineI­vcInsert>

i want to select this string and want to show this in csv file . for thisi
and doing string manuplation and find this substring and than add this toa
xml file and that converting this xml file to table and than showing the
data in csv file.

Is there another easy method?

Thanks,

Hemant

I think you can also do it making a loop through the document

Something like this

XmlNode p = xmlDoc.SelectSingleNode("//taSopLineIvcInsert");
foreach (XmlNode n in p)
{
Response.Write(n.Name + "/t" + n.InnerText + "/n");
}

if you add

Response.Clear();
Response.AddHeader("content-disposition",
"attachment;filename=doc.csv");
Response.ContentType = "application/vnd.ms-excel";

you should get an xml

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top