Castle Game Engine: CastleXMLUtils: Class TXMLElementIterator

# Class TXMLElementIterator
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleXMLUtils ## Declaration `type TXMLElementIterator = class(TObject)` ## Description Iterate over all children elements of given XML element. Without this, typical iteration looks like
    var
      Index: Integer;
      ChildrenList: TDOMNodeList;
      ChildNode: TDOMNode;
      ChildElement: TDOMElement;
    begin
      ChildrenList := Element.ChildNodes;
      try
        for Index := 0 to ChildrenList.Count - 1 do
        begin
          ChildNode := ChildrenList.Item[Index];
          if ChildNode.NodeType = ELEMENT_NODE then
          begin
            ChildElement := ChildNode as TDOMElement;
            ... here goes your code to process ChildElement ...
          end;
        end;
      finally FreeChildNodes(ChildrenList); end;
    end;
... which is an easy code, but it becomes tiresome to write this over and over again, especially for units that heavily process XML (like X3D XML or Collada readers). So this class allows you to write instead
    var
      I: TXMLElementIterator;
    begin
      I := TXMLElementIterator.Create(Element);
      try
        while I.GetNext do
        begin
          ... here goes your code to process I.Current ...
        end;
      finally FreeAndNil(I) end;
    end;
## Hierarchy TObject TXMLElementIterator ## Overview ### Methods
| `constructor Create(ParentElement: TDOMElement);`
| `destructor Destroy; override;`
| `function GetNext: boolean; virtual;`
### Properties
| `property Current: TDOMElement read FCurrent;`
## Description ### Methods
| `constructor Create(ParentElement: TDOMElement);`
| `destructor Destroy; override;`
| `function GetNext: boolean; virtual;`
### Properties
| `property Current: TDOMElement read FCurrent;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:13