Revision [1659]
This is an old revision of FunctionStAXgetEventType made by DavidLee on 2010-12-25 17:10:15.
Function getEventType
This function is part of the StAX support.
Name
getEventType returns the event type of the specified XMLEvent Event as a stringSynopsis
getEventType( $event)Description
getEventType returns the event type of the specified XMLEvent as a string.The following types are supported (see hasNext).
- START_ELEMENT
- END_ELEMENT
- PROCESSING_INSTRUCTION
- CHARACTERS
- COMMENT
- SPACE
- START_DOCUMENT
- END_DOCUMENT
- ENTITY_REFERENCE
- DTD
- CDATA
- NAMESPACE
- NOTATION_DECLARATION
- ENTITY_DECLARATION
(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: 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