var
xmlDomdoc : DomDocument60;
filenodes, groups : IXMLDomNodelist;
Node, subNode : IXMLDomNode;
tv : TTreeNode;
i, j : integer;
begin
xmlDomDoc := CoDomDocument60.Create;
xmlDomDoc.validateOnParse := false;
if not xmlDomDoc.load('
i:\Test\alone in the dark.xml')
then
begin
raise Exception.Create(xmlDomDoc.parseError.reason);
end;
TreeView.Items.BeginUpdate;
TreeView.Items.Clear;
filenodes := xmlDomDoc.documentElement.selectNodes('
file');
groups := xmlDomDoc.documentElement.selectNodes('
file/groups');
for i:= 0
to filenodes.length - 1
do
begin
Node := filenodes.item[i].selectSingleNode('
groups');
tv := TreeView.Items.Add(
nil, Node.text);
if(Node.childNodes.length > 0)
then
for j := 0
to Node.childNodes.length - 1
do
begin
subNode := filenodes.item[i].selectSingleNode('
groups/segments');
TreeView.Items.AddChild(tv, subNode.text);
end;
end;
TreeView.Items.EndUpdate;
end;