This is the Xml file i am trying to parse and i am trying to read the SealInTime text value which is 30 and i want to iterate through them
<?xml version="1.0" encoding="UTF-8" ?> - <Root> - <Header> <version>020412</version> <relaytype>M3425E</relaytype> </Header> - <SystemSetup> <SealInTime AI="1084" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1085" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1086" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1087" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1088" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1089" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1090" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> <SealInTime AI="1091" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime> </SystemSetup> </Root>
TiXmlDocument doc("ravi.xml"); if(!doc.LoadFile()) cout<<"cannot open file"; else{ TiXmlNode* root = doc.FirstChild( "Root" ); if (root ) { TiXmlNode* Node1=root->FirstChild( "Header" ); TiXmlNode* Node2=root->FirstChild( "SystemSetup" ); TiXmlElement* todoElement = Node2->FirstChildElement("SystemSetup"); TiXmlNode* Node3=root->FirstChild( "FunctionandSetpoints" ); if (Node1) { TiXmlElement* child = Node1->FirstChildElement( "version" ); if(!(child->GetText())) STemp='\0'; else STemp=child->GetText(); if (Node2)
{ TiXmlHandle docHandle(Node2); TiXmlElement* child = docHandle.FirstChild( "SystemSetup" ).FirstChild("SealInTime").ToElement();
for( child; child; child=child->NextSiblingElement() ) { for(i=1;i<=8;i++) tempim[8]=child->GetText(); }
}
I am trying to access using the above TiXmlhandle!!! I am not able to do it. Could please anyone help me in this matter!!!!
Log in to post a comment.
This is the Xml file i am trying to parse and i am trying to read the SealInTime text value which is 30 and i want to iterate through them
<?xml version="1.0" encoding="UTF-8" ?>
- <Root>
- <Header>
<version>020412</version>
<relaytype>M3425E</relaytype>
</Header>
- <SystemSetup>
<SealInTime AI="1084" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1085" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1086" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1087" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1088" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1089" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1090" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
<SealInTime AI="1091" Min="1" Max="8160" SF="1" nits="Cycles">30</SealInTime>
</SystemSetup>
</Root>
TiXmlDocument doc("ravi.xml");
if(!doc.LoadFile()) cout<<"cannot open file";
else{
TiXmlNode* root = doc.FirstChild( "Root" );
if (root )
{
TiXmlNode* Node1=root->FirstChild( "Header" );
TiXmlNode* Node2=root->FirstChild( "SystemSetup" );
TiXmlElement* todoElement = Node2->FirstChildElement("SystemSetup");
TiXmlNode* Node3=root->FirstChild( "FunctionandSetpoints" );
if (Node1)
{
TiXmlElement* child = Node1->FirstChildElement( "version" );
if(!(child->GetText())) STemp='\0';
else STemp=child->GetText();
if (Node2)
{
TiXmlHandle docHandle(Node2);
TiXmlElement* child = docHandle.FirstChild( "SystemSetup" ).FirstChild("SealInTime").ToElement();
for( child; child; child=child->NextSiblingElement() )
{
for(i=1;i<=8;i++)
tempim[8]=child->GetText();
}
}
I am trying to access using the above TiXmlhandle!!! I am not able to do it. Could please anyone help me in this matter!!!!