how i can use .getElementsByTagName in DOMNodeList Object ? Like:
procedure TForm1.selecionarClick(Sender: TObject);
var DOMDocument: iXMLDOMDocument;
DOMNodeList: iXMLDOMNodeList;
DOMNode: iXMLDOMNode;
DOMElement: iXMLDOMElement;
i: Integer;
begin
Memo.Text := '';
with DOMDocument do
begin
DOMDocument := coDOMDocument.Create;
DOMDocument.load( 'C:\Usuarios.xml' );
DOMDocument.preserveWhiteSpace := false;
DOMNodeList := DOMDocument.selectNodes( './/usuario[@codigo="'+codigo.Text+'"]/' );
for i := 0 to DOMNodeList.length - 1 do
begin
end;
end;
end;
My XML structure:
<?xml version="1.0" encoding="utf-8"?>
<usuarios>
<usuario codigo="1">
<nome>Name Node</nome>
<sobrenome>Last Name Node</sobrenome>
<cidade>City Node</cidade>
<estado>State Node</estado>
<email>Mail Node</email>
</usuario>
</usuarios>
IDOMElement supports getElementsByTagName which returns an IDOMNodeList. IDOMElement is a "subclass" of IDOMNode.
Hope that helps. :)