SAX-attributes objects used by the SAX-reader object are automatically created, populated, and deleted in the context of the startElement callback procedure. In that context, a programmer may use the methods and attributes of the object to modify it. However, if the programmer wants to use the contents of this SAX-attributes object outside of the short scope of the startElement callback, then the programmer must create another SAX-attributes object outside this scope and copy the SAX-reader’s SAX-attributes object to the new object.
A SAX-attributes object is an optional parameter for SAX-writer methods that create new XML elements. In this context, a programmer creates a new SAX-attributes object with the
CREATE SAX-ATTRIBUTES statement. Typically, a programmer populates the object by using the COPY-SAX-ATTRIBUTES method to save the contents of an automatically created SAX-attributes object. A programmer can also use the other attributes and methods to build up the attributes list from scratch. Either way, once the SAX-attributes object is populated, it can be used as an optional parameter on the START-ELEMENT( ) method, WRITE-DATA-ELEMENT( ) method, or the WRITE-EMPTY-ELEMENT( ) method of the SAX-writer object.