Class TXMLElementIterator
Unit
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; 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; 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 := Element.ChildrenIterator; 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); |
|
function GetNext: boolean; virtual; |
|
procedure Rewind; |
|
function Count: Integer; |
Properties
property Current: TDOMElement read FCurrent; |
Description
Methods
constructor Create(ParentElement: TDOMElement); |
|
This item has no description. |
function GetNext: boolean; virtual; |
|
This item has no description. |
procedure Rewind; |
|
This item has no description. |
function Count: Integer; |
|
This item has no description. |
Properties
property Current: TDOMElement read FCurrent; |
|
This item has no description. |
Generated by PasDoc 0.16.0-snapshot.