To display child node contents in the XML file

  1. In the Object Inspector with Button1 selected, double-click the OnClick event on the Events tab. The Code displays with the cursor in the TForml.Buttonlciick event handler block.
  2. Enter the following code to display the stock price for the first child node when the Borland button is clicked:

BorlandStock:=XMLDocument1.DocumentElement.ChildNodes[0]; Price:= BorlandStock.ChildNodes['price'].Text; Memol.Text := Price;

3. Add a var section just above the code block in the event handler, and enter the following local variable declarations:

BorlandStock: IXMLNode; Price: string;

  1. In the Object Inspector with Button2 selected, double-click the OnClick event on the Events tab. The Code displays with the cursor in the TForml.Button2ciick event handler block.
  2. Enter the following code to display the stock price for the second child node when the MyCompany button is clicked:

MyCompany:=XMLDocument1.DocumentElement.ChildNodes[1]; Price:= MyCompany.ChildNodes['price'].Text; Memol.Text := Price;

6. Add a var section just above the code block in the event handler, and enter the following local variable declarations:

MyCompany: IXMLNode; Price: string;

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment