By Rajeev Rajan (Qualcomm Inc, USA)
Version: Borland C++ Builder ver 5 (BCB5) Integrated Development Environment (IDE).
Due to paucity of time, I haven't pursued the above problems further, but just hacked around them. I guess I will pursue them, when the need arises or something fishy happens. If someone else does before me, please let me know the solutions. :-)
//-- Load the input xml file, and call execute.
xmlScanner->LoadFromFile("c:\\myfile.xml");
xmlScanner->Execute();
If you want to use the TXmlParser component from within TXmlScanner, a pointer to the same is available in the TXmlScanner object. I've given some sample code below on how to use it.
For example:
If XmlScanner1 is the name of your TXmlScanner object:
//-- Load the input xml file..
XmlScanner1->LoadFromFile("c:\\myfile.xml");
//-- Init the scanning.
XmlScanner1->XmlParser->StartScan();
//-- Loop thru the file for each item.
AnsiString s;
while (XmlScanner1->XmlParser->Scan())
{
switch (XmlScanner1->XmlParser->CurPartType)
{
case ptStartTag : //-- Got Start tag.
s = XmlScanner1->XmlParser->CurName;
break;
case ptContent : //-- Got content.
s = XmlScanner1->XmlParser->CurContent;
break;
//-- Add other cases here as required..
default :
break;
}
}
2000-07-27 Rajeev Rajan
2001-02-28 Stefan Heymann: Added a note on the OnLoadExternal problem