[delphi]Atrybuty w XML i petla

0
<sett>
<!-- profile attribute colours -->
<ite name="aaa" aaa="2" />
<ite name="bbb"aaa="3"   />
<ite name="ccc" aaa="4"  />
</sett>

Nie moge wczytac naraz wszytskich wartosci atrybutu name do listboxa. Bawilem sie petlami ale nie wyszlo. Np.:

XML.Active := True;
XML.LoadFromFile(colorxml);


for i:=0 to xml.documentelement.childnodes.Count-1 do

listbox1.Items.Add(string(xml.documentelement.ChildNodes[i].Attributes['name']));
 end;
0

Moze inaczej zadam pytanie. Czy można wydobyć wartości atrybutów parametru "name" w childach "ite"?

1

Kod:

  with TXMLDocument.Create(Self) do
  begin
    Options := Options + [doNodeAutoIndent];
    Active := True;
    LoadFromFile(colorxml);
    for i := 0 to DocumentElement.ChildNodes.Count - 1 do
      if DocumentElement.ChildNodes[i].LocalName = 'ite' then
        ListBox1.Items.Add(String(DocumentElement.ChildNodes[i].Attributes['name']));
  end;

XML:

<?xml version="1.0" encoding="UTF-8"?>
<sett>
	<!-- profile attribute colours -->
        <ite name="aaa" aaa="2" />
        <ite name="bbb" aaa="3" />
        <ite name="ccc" aaa="4" />
</sett>
0

Jesteś WIELKI! Dzięki bardzo.

1 użytkowników online, w tym zalogowanych: 0, gości: 1