

The ContentHandler’s use of set! does not leak mutable data out into the rest of Clojure. Clojure permits this style as an explicit special case, and you should use it for interop purposes only. It is worth noting that this style of coding is the industry norm: objects are mutable, and programs are single-threadedly oblivious to the possibility of concurrency. (This is important primarily when inside character data, which is not shown here.)ĮndElement reverses the work of startElement by popping the *stack* and placing the top of the *stack* in *current*.

The *current* is the current element, and the *state* keeps track of what kind of content is inside.

The *stack* is a stack of all the elements the current element is nested inside. The callback handler updates three thread-local variables. Use Atoms for Uncoordinated, Synchronous UpdatesĪ SAX parser calls startElement when it encounters an XML start tag.Adding Ant Projects and Tasks to Lancet.Creating and Compiling Java Classes in Clojure.
