Revision [1620]

This is an old revision of FunctionStAXhasNext made by DavidLee on 2010-12-06 10:07:32.

 

Function hasNext


This function is part of the StAX support.

Name

hasNext returns true if the StAX stream has a pending next event (optionally of the requested type and name).


Synopsis

hasNext( $reader )
hasNext( $reader type )
hasNext( $reader type name )


Description


hasNext has 3 forms. Each returns true if there is a (matching) next event and false if at EOF (with no matching next event).
Unlike the Java XMLEventReader method of the same name, hasNext advances the stream to the matching event (or EOF if no match).
This allows a significantly simplier and more efficient implemenation when processing a subset of event types and names.

The first argument must be an XMLEventReader created from the newEventReader function.
If a second argument is present it must be one of the "XMLEvent" types (as a string)

(Note that ATTRIBUTE events will not occur in the input stream, they are contained within START_ELEMENT events).

If a third argument is present and only if the event type is START_ELEMENT or END_ELEMENT then the argument is interpreted as a QName and hasNext advances until a matching START_ELEMENT or END_ELEMENT event is found.



To use the StAX functions you need to import them into either the global namespace or a local namespace.
Its recommended that you use a local namespace so that there is less chance of name collisions.


Example
import commands stax=stax
reader=stax:newEventReader( file.xml )




Commands
StAX Functions
newEventReader
nextEvent
Java Objects
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki