www.destructor.de

About | Contact | Impressum


Home |  Code |  Articles |  Misc |  x
XML Parser |  TAR Library |  Linked Lists |  WinSock 1.1 |  x
General |  Downloads |  Documentation |  History |  Links |  x
x

XML Parser: Examples of extraction of attribute values and entity values

By Rajeev Rajan (Qualcomm Inc, USA)

Version: Borland C++ Builder ver 5 (BCB5) Integrated Development Environment (IDE).


void __fastcall TMainForm::xmlScannerStartTag(TObject *Sender,
      AnsiString TagName, TAttrList *Attributes)
{
  //-- Construct the tag as : <TagName>
  AnsiString s = "<" + TagName + ">";

  //-- Get the attributes, if any..
  for (int i=0; i<=(Attributes->Count-1); i++)
  {
    //-- Get each individual name-attr value
    TAttr* node = (TAttr *)(Attributes->Items[i]);
    AnsiString attrName = node->Name;
    AnsiString attrVal = node->Value;

    //-- Add them to the list..
    s += " [" + attrName + ", " + attrVal + "] ";
  }
  
  //-- Use s as required.
}

void __fastcall TMainForm::xmlScannerEntity(TObject *Sender,
      TEntityDef *EntityDef)
{
  AnsiString s;
  s = "Entity Name = " + EntityDef->Name +
      " Value = " + EntityDef->Value +
      " SysId = " + EntityDef->SystemId +
      " PublicId = " + EntityDef->PublicId;

  //-- Print out the value of s.
}