Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Parsing XML file
vimal kumar
15y
2.6k
1
Reply
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
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Treeview to XML
Reading DTD files in Vb.Net