om.XmlReader.read

Reads the next SAX event to process.

Syntax

read()
  RETURNS STRING

Usage

The read() method reads the next XML fragment and returns the name of the SAX event to process.

Table 1. Events that can be returned by the read()method
Event name Description Action
StartDocument
Beginning of the document Prepare processing (allocate resources)
StartElement
Beginning of a node Get current element's tag name or attributes with getTagName() getAttributes()
Characters
Value of the current element Get current text element's value with getCharacters()
SkippedEntity
Reached skipped entity Get current skipped entity element's value with skippedEntity()
EndElement
Ending of a node Get current element's tagname with getTagName()
EndDocument
Ending of the document Finish processing (release resources)

Example

DEFINE r om.XmlReader,
       e STRING
   ...
   LET e = r.read()
   WHILE e IS NOT NULL
     CASE e 
       ...
     END CASE
     LET e = r.read()
   END WHILE

For a complete example, see Example 1: Parsing an XML file.