Little Libxml Update

BlitzMax Forums/Brucey's Modules/Little Libxml Update

beanage(Posted 2010) [#1]
I recently added some lines to Libxml, which allow enumerating a nodes children the EachIn-way; instead of iterating through Node.getChildren. This gives significant differences in mem consuption and speed when iterating nodes with large amounts of children. Inherently, this may be a useful official update:

Add these lines to TxmlBase...
Method ObjectEnumerator:TxmlBaseEnumerator()
	Return TxmlBaseEnumerator.Create( Self )
End Method

...and these to the private area...
Type TxmlBaseEnumerator
	
	Field _next:TxmlBase
	
	Function Create:TxmlBaseEnumerator( parent_:TxmlBase )
		Local ret_:TxmlBaseEnumerator = New TxmlBaseEnumerator
		ret_._next = TxmlBase.chooseCreateFromType( Byte Ptr( Int Ptr( parent_._basePtr + TxmlBase._children )[0] ) )
		
		Return ret_
	End Function
	
	Method HasNext:Int()
		Return _next<> Null
	End Method
	
	Method NextObject:Object()
		Local ret_:TxmlBase = _next

		_next = _next.nextSibling()
		Return ret_
	End Method
	
End Type