captainc Messages: 278 Registered: December 2006 Location: New Jersey, USA
Experienced Member
TeCNoYoTTa wrote on Wed, 16 July 2008 18:30
thanks very much ......i appreciate your help
but please tell me what these functions do
Xml_File.End()
Xml_File.PassEnd()
Xml_File.Skip()
I agree with you on some confusion with the xml parsing functions.
Unfortunately, my gripe with the xml parser is that it requires a lot of code to make it work correctly.
The End() function checks to see if the current token is an ending tag (Ie. </day>). At the same time, it will advance to the next token.
The PassEnd() function calls End(). So it expects that you already known that the current token is an ending tag and you want to pass it and go to the next token. If it is not an ending tag, then it throws an exception.
The Skip() function skips tokens till the next tag is reached, skipping over the ending tags as you go.
Note, tags specified like: <singletag attr1="value"/> will register as true for being an ending tag!
I was able to account for this through loops like:
XmlParser xp(xmlstr);
...
while(!xp.End()){
if(xp.Tag("mytag")){
//read attributes from tag
if(xp.IsEnd()){xp.PassEnd();} //this checks for singletag case
}else{ xp.Skip(); }
}
I wish there was a way to just convert an entire xml string into a hierarchy of vector/vector-maps! Maybe I'll work on one.