| |

VerySource

 Forgot password?
 Register
Search
View: 634|Reply: 2

A xml problem

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-11 17:30:01
| Show all posts |Read mode
<NewDataSet>
  <Table>
    <ID> 19 </ ID>
    <title> Altay </ title>
  </ Table>
  <Table>
    <ID> 20 </ ID>
    <title> Ankang </ title>
  </ Table>
  <Table>
    <ID> 21 </ ID>
    <title> Anqing </ title>
  </ Table>
<NewDataSet>

How can I read this effect: 19, 20, 21
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-8 21:00:02
| Show all posts
xpath=@"//ID"
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-6-9 13:00:01
| Show all posts
XmlDocument doc = new XmlDocument();
doc.Load(file);
XmlNodes nodes = doc.SelectNodes("/NewDataSet/Table/ID");
foreach(XmlNode in nodes)
{
    Console.WriteLine(node.InnerText);
}
Or you can get it into the dataset
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list