xHarbour Reference Documentation > Class Reference (textmode) |
Creates a new TXmlIterator object.
TXmlIterator():new( <oTXmlNode> ) --> oTXmlIterator
The function returns a TXmlIterator object and method :new() initializes it.
The TXmlIterator class provides objects for iterating nodes in an XML document and its sub-nodes (in the XML tree). An XML document is managed by an object of the TXmlDocument() class.
The creation of a TXmlIterator object requires a TXmlNode() object wich serves as starting point for the iterator. The iterator is restricted to the branch in the XML tree represented by the initial XML node.
See also: | TXmlDocument(), TXmlNode(), TXmlIteratorScan(), TXmlIteratorRegEx() |
Category: | Object functions , xHarbour extensions |
Source: | rtl\txml.prg |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example use the Customer.xml file as created with the // TXmlDocument() example, and extracts from it the field names // of the database structure. Note that the iterator is restricted // to the subnodes of the "structure" node. PROCEDURE Main LOCAL oXmlDoc := TXmlDocument():new() LOCAL oXmlNode, oXmlIter oXMlDoc:read( Memoread( "customer.xml" ) ) oXmlNode := oXmlDoc:findFirst( "structure" ) oXmlIter := TXmlIterator():new( oXmlNode ) DO WHILE .T. oXmlNode := oXmlIter:next() IF oXmlNode == NIL EXIT ENDIF ? oXmlNode:getAttribute( "name" ) ENDDO RETURN
http://www.xHarbour.com