Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML File reading/updating/writing

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I'm looking for a simple example of using Delphi to display the contents of an XML file and allow the user to update fields (within tags) and also add new entries and delete existing ones.
Ideally I'd like the xml fields to be displayed in a grid (a TStringGrid more than likely I assume)
Can anyone point me to something like this ?
Is it possible ?
Steve
 
You need to use the TDomDocument type.

You will have to import the MSXML_TLB type library first.
Here's a snippet from my code:-

XMLDoc : TDomDocument;
:

XMLDoc.async:=True;

Status:=XMLDoc.load(sFile);
if (Status=False) then
raise exception.Create('Could not load the XML file');

//Get djUniqueID
NodeList := XMLDoc.getElementsByTagName('uniqueid');
ID := StrToFloat(NodeList.item[0].Get_Text);
:

I have only read the xml file, but there is probably a setElementByTabName or something.

lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top