TXMLDocument and TTreeView



I've been tinkering with the idea of using a TTreeView to display the
contents of an XML file.

I can parse the TXMLDocument and add nodes to the tree with no
problems, but it would be really useful if I could attach each node to
the Data property so that I can access it immediately.

The Data porperty is a (System.)Pointer, but the object I use when
traversing the XML Document is a (XMLIntf.)IXMLNode, and I can't work
out how to use these two together.

I tried
tn.Data := addr(iNode);
which worked ok.

Then in my TreeView OnClick method, I want to get the XML node back
again by accessing the Data object, but I can't work out how to do it.

iNode := tn.Data^;
doesn't work, and neither does
iNode := tn.Data^ as IXMLNode;

I guess this is something to do with the fact that IXMLNode is an
interface and I don't really understand how it works.

Can anyone enlighten me, please?

Phil

.



Relevant Pages

  • Re: TXMLDocument and TTreeView
    ... contents of an XML file. ... I can parse the TXMLDocument and add nodes to the tree with no ... I guess this is something to do with the fact that IXMLNode is an ... interface and I don't really understand how it works. ...
    (alt.comp.lang.borland-delphi)
  • Re: TXMLDocument and TTreeView
    ... when traversing the XML Document is a IXMLNode, ... interface and I don't really understand how it works. ... which was added in Delphi 6) with an explicit IXMLNode property. ... I should have checked that the Data property of a TTreeNode was ...
    (alt.comp.lang.borland-delphi)
  • Re: TXMLDocument and TTreeView
    ... contents of an XML file. ... the Data property so that I can access it immediately. ... interface and I don't really understand how it works. ... was added in Delphi 6) with an explicit IXMLNode property. ...
    (alt.comp.lang.borland-delphi)
  • Re: TXMLDocument and TTreeView
    ... when traversing the XML Document is a IXMLNode, ... interface and I don't really understand how it works. ... which was added in Delphi 6) with an explicit IXMLNode property. ... I should have checked that the Data property of a TTreeNode was ...
    (alt.comp.lang.borland-delphi)
  • Re: Beginner with Questions re: WPF, WCF, LINQ
    ... Dave wrote: ... but the frontend will create a data object from the XML automagically. ... It will actually be XML ...
    (microsoft.public.dotnet.languages.csharp)