Help: How do we read such XML file in C++??
Hi All,
i have to make Xml Reader class in VC6(MFC) which could read an XML file(mentioned below) and extract information from it and use it for further processing, now the problem is this XML file has nested references within it's nodes....
(partial XML file..)_______________________________________________________________
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-
ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<a1:dlgChildMonoRail id="ref-1"xmlns:a1="http://schemas.microsoft.com/clr/nsassem/EDS_Generator/Adv%2C%20Version%3D1.5.1.26410%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">
<Rail0 href="#ref-3"/>
<NetworkingModule href="#ref-4"/>
<Echelle>75</Echelle>
<IslandParameters href="#ref-5"/>
<BuildParameters href="#ref-6"/>
<CanDragDropRailToRail>false</CanDragDropRailToRail>
<m_Consommations href="#ref-7"/>
<NbMaxTypeModule href="#ref-8"/>
<m_TypeConfiguration xsi:type="a1:EnumTypeModule" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/EDS_Generator/Adv%2C%20Version%3D1.5.1.26410%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">CanOpen</m_TypeConfiguration>
</a1:dlgChildMonoRail>
<a1:Rail id="ref-3" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/EDS_Generator/AdvantysLite%2C%20Version%3D1.5.1.26410%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">
<Top>32</Top>
<Left>10</Left>
<RailName id="ref-9">Segment </RailName>
<RailNumber>1</RailNumber>
<BitmapPath id="ref-10">C:\Program Files\Adv\Bitmap\Rail.jpg</BitmapPath>
<BitmapVidePath id="ref-11">C:\Program Files\Adv\Bitmap\RailVide.jpg</BitmapVidePath>
<m_IsRailVide>false</m_IsRailVide>
<Echelle>75</Echelle>
<CanDragDropRailToRail>false</CanDragDropRailToRail>
<IsNetworkingRail>true</IsNetworkingRail>
<m_nbModuleMax href="#ref-12"/>
<module0 href="#ref-13"/>
<module1 href="#ref-14"/>
<module2 href="#ref-15"/>
<module3 href="#ref-16"/>
<module4 href="#ref-17"/>
<module5 href="#ref-18"/>
<module6 href="#ref-19"/>
<module7 href="#ref-4"/>
</a1:Rail>
<a1:Module id="ref-4"
xmlns:a1="http://schemas.microsoft.com/clr/nsassem/EDS_Generator/AdvantysLite%2C%
20Version%3D1.5.1.26410%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">
<Top>18</Top>
<Left>0</Left>
<Height>224</Height>
<Width>120</Width>
<Echelle>75</Echelle>
<PositionOnRail>0</PositionOnRail>
<RailNumber>1</RailNumber>
<Module_Name id="ref-20">OTB 1C0 DM9LP</Module_Name>
<Module_Number>0</Module_Number>
<BitmapPath id="ref-21">OTB 1C0 DM9LP.jpg</BitmapPath>
<Vendor_Code id="ref-22">0x0500005a</Vendor_Code>
<Vendor_Name id="ref-23">Tele</Vendor_Name>
<Version id="ref-24">255</Version>
<Help_File href="#ref-25"/>
<Help_Index href="#ref-26"/>
<Description id="ref-27">The OTB 1C0 DM9LP is a Network Interface Module (NIM) for
CANopen with following features:
12 digital inputs,
6 relay outputs,
2 source transistor outputs,
2 remote Fast Counters (RFC).
Maximum data in PDO for this module:
32 words input,
32 words output.
Maximum Analog :
24 input channels,
24 output channels.
</Description>
<TooltipInfo id="ref-28">Head CANopen bus Node</TooltipInfo>
<CanBeMoved>false</CanBeMoved>
<IsAtLeastOneColumnRuleInGrid href="#ref-29"/>
<IdentificationCode>235</IdentificationCode>
<IsNetworkingModule>true</IsNetworkingModule>
<IsExtensibleModule>true</IsExtensibleModule>
<ConfigurationModuleNumber>0</ConfigurationModuleNumber>
<Revision id="ref-30">255</Revision>
<Type_Module>1</Type_Module>
<XmlNameFamily id="ref-31">FAMILY_MODULE_0</XmlNameFamily>
<XmlNameModule id="ref-32">MODULE_0</XmlNameModule>
<ConsommationCourant>0</ConsommationCourant>
<m_Consommations href="#ref-33"/>
<m_NbMaxTypeModule href="#ref-34"/>
<ConsommationVoiesIN>0</ConsommationVoiesIN>
<ConsommationVoiesOUT>0</ConsommationVoiesOUT>
<AnalogOrTOR xsi:type="xsd:anyType" xsi:null="1"/>
<m_IsModbus>false</m_IsModbus>
<m_IsEthernet>false</m_IsEthernet>
<m_ProductNumber id="ref-35">0xFEFB</m_ProductNumber>
<m_RevisionNumber id="ref-36">0x10001</m_RevisionNumber>
<Data href="#ref-37"/>
<Rules href="#ref-38"/>
<NbModuleMax href="#ref-39"/>
<NetworkingModule href="#ref-4"/>
<m_TabulationAndGridDefinition href="#ref-40"/>
<m_ArrayTPDO href="#ref-41"/>
<m_ArrayRPDO href="#ref-42"/>
<m_ArrayTPDOSelected href="#ref-43"/>
<m_ArrayRPDOSelected href="#ref-44"/>
<m_SubObjectsSelectedInPDO href="#ref-45"/>
<m_EthernetModbusSizeAvailable href="#ref-46"/>
<m_EthernetModbusUsed href="#ref-47"/>
<m_PDOHide xsi:type="xsd:anyType" xsi:null="1"/>
<IOmapCompacted>false</IOmapCompacted>
<ListSymboles href="#ref-48"/>
</a1:Module>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_______________________________________________________________
As i am a newbee with XML i have no idea how to read such XML and extract data sequentially or from whichver elements required?, if you could provide a tutorial or some help i would really be very thankfull to you, Thanks in Advance!
Regards,
Prince
______________
Re: Help: How do we read such XML file in C++??
if you want to start XML Just go with this Link this Will help you to Solve your Problem.
http://www.codeguru.com/forum/showth...&highlight=XML
Thanx
Re: Help: How do we read such XML file in C++??
Quote:
Originally Posted by humptydumpty
Hii Humpty dumpty, Thanks for your speedy response buddy, but that is not what i asked??, even though am a new bee to XML but i know to parse/read a file, the problem here is this file has nested references in the Nodes which are explained further down the file(please take a look of the file), i haven't come accross this kind of XML before so was looking for some help?. Thanks in Advance!
Re: Help: How do we read such XML file in C++??
See dude .First thing use Code tag in your Post .so anyone can easily understand What you
Want. and Better With try to explain it in a Small Example Form.So do this . so AnyOne can understand your Problem and Help you.
Thanx
Re: Help: How do we read such XML file in C++??
@ huptydumpty: yes i apologise for that, well i'll surely take care of that in future, so is there anything you can help me with dude?
<a1:dlgChildMonoRail id="ref-1"xmnls...............
<Rail0 href="#ref-3"/>........// here for Rail0 there is a reference which is described below, how to read this programaticaly through DOM??
</a1>
<a1:Rail id="ref-3" xmlns:a1="http://sch.......
</a1:Rail>
Re: Help: How do we read such XML file in C++??
See Dudes these are the Node Attribute you can Read it like Other Attribute.Actually What The Problem you are getting here can you Show your code.and one more thing are you the one who is responsible for creating xml.if yes can you tell exactly for what you are looking. and it's always better to keep your xml in simple form.if you specify your requirement.may be we can simplify.your xml so it's easy to parse for you.
Thanx
Re: Help: How do we read such XML file in C++??
i m not able to read data from any of .xml file.
Pls help me to write code or send any example regarding this.
thanks in advance