SAX-PARSE-NEXT( ) method
- Last Updated: October 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Continues a progressive-scan parse of an XML document associated with a SAX-reader object.
Return type: None
Applies to: SAX-reader object handle
Syntax
|
SAX-PARSE-NEXT( ) returns after the parser finds the next XML token in the XML source and the AVM invokes the corresponding callback, if it exists.
When SAX-PARSE-NEXT( ) starts, an error is raised if the PARSE-STATUS attribute is anything other than SAX-RUNNING. This might occur if:
- SAX-PARSE-NEXT( ) is called before SAX-PARSE-FIRST( ) is called
- STOP-PARSING( ) is called
Eventually, SAX-PARSE-NEXT( ) fails to find another XML token (assuming the parse does not stop early). When this happens, the AVM sets the PARSE-STATUS attribute to SAX-COMPLETE. If SAX-PARSE-NEXT( ) is called at that point, an error is raised.
ERROR-STATUS:ERROR.To stop a progressive-scan parse, you can refraining from calling SAX-PARSE-NEXT( ).
However, when you detect that it is time to stop, you will most likely be in a callback, so
you need a way to communicate that it is time to stop to the driver (where SAX-PARSE-NEXT( )
is called). A convenient way to do that is to call SELF:STOP-PARSING( ),
since that causes the AVM to set the value of PARSE-STATUS to SAX-COMPLETE.