TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
vimal kumar
NA
3
0
Parsing XML file
Sep 2 2009 8:05 AM
Hi i had been using XercersDomParser for parsing the XML file in C++
I am not familiar with XML. In the follwing XML file
<?xml version="1.0" encoding="UTF-8"?>
<Locomotives>
<Locomotive xmlns="
http://localhost:8080/source/schemas/locomotive.xsd
" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
" xsi:schemaLocation="
http://localhost:8080/source/schemas/locomotive.xsd
http://localhost:8080/source/schemas/locomotive.xsd
">
<LocoId>9001</LocoId>
<LocoRunNumber>UnReg</LocoRunNumber>
<LocomotiveGPSData>
<SampleTime>2008-07-13T13:37:33</SampleTime>
<Latitude>-32.86693333</Latitude>
<Longitude>151.75333333</Longitude>
<Speed>-1</Speed>
<Direction>-1</Direction>
<KmPostPosition>178500</KmPostPosition>
<TrackNumber>85</TrackNumber>
</LocomotiveGPSData>
<Events>
<Alarms>0</Alarms>
<Faults>0</Faults>
</Events>
</Locomotive>
<Locomotive xmlns="
http://localhost:8080/source/schemas/locomotive.xsd
" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
" xsi:schemaLocation="
http://localhost:8080/source/schemas/locomotive.xsd
http://localhost:8080/source/schemas/locomotive.xsd
">
<LocoId>9002</LocoId>
<LocoRunNumber>UnReg</LocoRunNumber>
<LocomotiveGPSData>
<SampleTime>2008-07-13T23:59:56</SampleTime>
<Latitude>-32.61888333</Latitude>
<Longitude>151.14988333</Longitude>
<Speed>-1</Speed>
<Direction>-1</Direction>
<KmPostPosition>239000</KmPostPosition>
<TrackNumber>87</TrackNumber>
</LocomotiveGPSData>
<Events>
<Alarms>0</Alarms>
<Faults>0</Faults>
</Events>
</Locomotives>
Eventhough i can traverse through XML file through
DOMTreeWalker but can't get idea to store Values in a strucured <list>
the structure look like this
typedef
struct
{
Loco_Id LocoId ;
string
/*DateTime*/
SampleTime ;
float
Lattitude;
float
Longitude;
float
Speed ;
float
Direction;
int
KmPostPosition;
int
TrackNumber;
int
Alarms;
int
Failures ;
}LocoDetails
Can any one tell how to access the value from the XML file and store to a list
Reply
Answers (
0
)
Treeview to XML
Reading DTD files in Vb.Net