Here are some links I have had from the past dealing with older Delphi and XML:

http://www.agnisoft.com/white_papers/xml_delphi.asp
http://www.destructor.de/xmlparser/doc/delphi-installation.htm
http://www.delphi3000.com/articles/article_2021.asp?SK=
http://www.delphigroups.info/2/7/818322.html

Hope that gets you where  you want to be.

Greg

-----Original Message-----
From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of 
Brendan Blake
Sent: Thursday, January 27, 2011 5:31 AM
To: 'Moderated List for the Discussion of Delphi 
ProgrammingexcludingDatabase-related topics'
Subject: RE: Delphi & MSXML


Delphi provides a wrapper component designed to read, create and parse XML
documents: TXMLDocument, which I think would make your job much easier.

But you won't have this if you are using Delphi 5 - it was first released in 
Delphi 7 I recall.  

You can read about using XML with Delphi here, but I think this is based on 
later versions of Delphi than yours....
http://delphi.about.com/od/windowsshellapi/a/xml_delphi.htm 

Maybe someone has worked out how to port TXMLDocument back onto Delphi5....
might be quite easy if you have the Delphi 7 source.  Otherwise - upgrade?

Regards,
       Brendan Blake.


-----Original Message-----
From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of 
Steve Bowker
Sent: 26 January 2011 09:44
To: delphi elists
Subject: Delphi & MSXML

Hi,
Has anyone had any experience of using Delphi (5) & MSXML?  I can't seem to 
find any decent example code or tutorials on Google. 

I've got as far as receiving the XML via a client socket, so have the XML as 
one long string.
Here is the sample XML as it would look in text format:
<query>
  <result>success</result>
  <id>01234567890</id>
  <balance>54.50</balance>
  <tickets>320</tickets>
  <holder_title>Mr</holder_title>
  <holder_firstname>Steve</holder_firstname>
  <holder_surname>Smith</holder_surname>
</query>

The 1st element after <query> will always be <result> and if 'success'  it is 
followed by the returned elements above, else it will return elements 
containing <failcode> & <failreason>

Here's the (not very elegant) pseudo code of what I want to do with this, can 
anyone provide the actual Delphi(5) code to acheive this?

uses
  MSXML2_TLB;

procedure ProcessAllelementsFromXML;
var
  ElementName, ElementValue: string;
  Doc: IXMLDOMDocument;
begin
  Doc := CoDOMDocument.Create;

if Doc.LoadXML(strXML) then
begin
  if Doc.RootNode = '<query>' then
  begin
    for i := 0 to NumberOfElementsWithinQueryNode do
    begin
      ElementName := Doc.ElementName[i];
      ElementValue := Doc.ElementValue[i];
      if ElementName = 'success' then
        carry on with loop and populate some text fields from ElementName & 
Value
      else
        carry on with loop and process each <failcode> & <failreason>
    end;
  end
  else if Root Node = 'adjust' then
  begin
    as above but different element names are processed slightly differently
  end;
end;
end;

Thanks in advance for any help,
Steve
_______________________________________________
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to