Context

As an exception to the way SAX usually signals events downstream to the next handler, there is a protocol to establish a so-called "sax-parser" object, using which the generator of the SAX events makes optional information available. (Normally, you can just call the following functions on the SAX handler itself, but be aware that the "sax-parser" object must have been installed in the handler using the register-sax-parser event for those functions to work.)

SAX:LINE-NUMBER (handler-or-parser) function
SAX:COLUMN-NUMBER (handler-or-parser) function
SAX:SYSTEM-ID (handler-or-parser) function
SAX:BASE-URI (handler-or-parser) function

LINE-NUMBER and COLUMN-NUMBER return the position of the latest event within the document as an integer.

SYSTEM-ID and BASE-URI basically return the current file name, but since XML refers to files as URIs, you get the namestring wrapped in a file:// URI. In some special cases, the system ID can actually be a non-file URI, e.g. if you've taught cxml to parse files over the network using an "entity resolver" object.

BASE-URI defaults to SYSTEM-ID, but can be overridden using xml:base attributes. Users should normally depend on the BASE-URI (not SYSTEM-ID) in order to be base-uri-aware.