Try OpenEdge Now
skip to main content
Working with XML
Writing XML Documents with the Simple API for XML (SAX) : Handling errors
 

Handling errors

The WRITE-STATUS attribute is your view into the error status of a SAX-writer object. The value of the attribute is interpreted differently depending upon the value of the STRICT attribute. When STRICT is set to TRUE, any method call that would result in invalid XML sets the WRITE-STATUS attribute to SAX-WRITE-ERROR. When STRICT is FALSE, only errors that prevent the write from starting or raise exceptions set the WRITE-STATUS attribute to SAX-WRITE-ERROR. Essentially, STRICT = TRUE is more sensitive and useful for development and troubleshooting mode.
STRICT = FALSE will only stop a document from being written if the error prevents the write from starting or continuing and may be a better choice for production mode.
If the SAX-writer does have a status of SAX-WRITE-ERROR, only the methods which reinitialize the object can be called: SET-OUTPUT-DESTINATION and RESET. The object attributes will still be readable and writable.
* How errors are handled when STRICT is FALSE
* How errors are handled when STRICT is TRUE
* Errors raised by invalid method calls during SAX-writer states
* Example of changing values in the WRITER-STATUS attribute
* Handling codepage conversions