Event-based XML parsing
Furnace framework > XML parser

Prev:Reading XML
Next:Working with XML namespaces


In addition to DOM-style parsing based around read-xml, the XML module also provides SAX-style event-based parsing. This uses much of the same data structures as normal XML, with the exception of the classes xml and tag and as such, the article xml.data may be useful in learning how to process documents in this way. Other useful words are:
each-element ( stream quot: ( xml-elem -- ) -- )

opener

closer

contained


There is also pull-based parsing to augment the push-parsing of SAX. This is probably easier to use and more logical. It uses the same parsing objects as the above style of parsing, except string elements are always in arrays, for example { "" }. Relevant pull-parsing words are:
<pull-xml> ( -- pull-xml )

pull-xml

pull-event ( pull -- xml-event/f )

pull-elem ( pull -- xml-elem/f )