Function getEventType


This function is part of the StAX support.

Name

getEventType returns the event type of the specified XMLEvent Event as a string


Synopsis

getEventType( $event)



Description

getEventType returns the event type of the specified XMLEvent as a string.

The following types are supported (see hasNext).

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



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


Given an xml file "file.xml"
<file xmlns:a="www.test.com">
 <a:element attr="attr1"/>
 <a:element attr="attr2">String</a:element>
</file>


Print the event type of every event
import commands stax=stax
reader=stax:newEventReader( file.xml )
while [ stax:hasNext( $reader  ) ] ; do
	event=stax:nextEvent( $reader ) ;
	echo stax:getEventType($event)
done

stax:closeReader $reader 


Result

START_DOCUMENT
START_ELEMENT
CHARACTERS
START_ELEMENT
END_ELEMENT
CHARACTERS
START_ELEMENT
CHARACTERS
END_ELEMENT
CHARACTERS
END_ELEMENT
END_DOCUMENT




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