Thanks for your reply. The xml is a typo mistake. But still not able to load the xml (after correcting xml file) since the xml file contains special character. It seems that the file should be saved using UTF-8 encoding format. After changing the format
it seems to working good.
dj_naveen
Member
26 Points
35 Posts
Need help to read xml nodes using c#
Jan 25, 2013 02:41 AM|LINK
Hi,
I am trying to read the below xml file
<NewDataSet> <Table> <Node1>1.00</Node1> <Node2>1000</Node2> <Node3>µ¼Ü³É</Node1> </Table> <Table> <Node1>2.00</Node1> <Node2>2000</Node2> <Node3>µ¼Ü³É</Node1> </Table> </NewDataSet>I am getting the below error after doc.Load(@"c:\testapp\sample.xml");
"Invalid character in the given encoding. Line 5, position 12."
My understanding is the special characters in xml file throws this exeception.
Kindly help me to overcome this issue and also I need to all the table nodes (need to loop all the table nodes in order to read the
respective child nodes)
brijeshvaidy...
Participant
848 Points
231 Posts
Re: Need help to read xml nodes using c#
Jan 25, 2013 03:40 AM|LINK
http://support.microsoft.com/kb/307548?wa=wsignin1.0
http://stackoverflow.com/questions/4650277/xml-node-reading-for-each-loop
http://www.drdobbs.com/windows/parsing-xml-files-in-net-using-c/184416669
Brijesh Vaidya
India
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Need help to read xml nodes using c#
Jan 26, 2013 11:54 PM|LINK
Not only the problem, but your "Node3" without the end of "Node3".
Please fix something like this:
Then your codes should be something like this:
dj_naveen
Member
26 Points
35 Posts
Re: Need help to read xml nodes using c#
Jan 28, 2013 01:17 AM|LINK
Hi Decker Dong - MSFT,
Thanks for your reply. The xml is a typo mistake. But still not able to load the xml (after correcting xml file) since the xml file contains special character. It seems that the file should be saved using UTF-8 encoding format. After changing the format it seems to working good.