Utilities for traversing XML - Factor Documentation (original) (raw)

Utilities for traversing XML

The xml.traversal vocabulary provides utilities for traversing an XML DOM tree and viewing the contents of a single tag. The following words are defined:

An example of XML processing

tag-named ( tag name/string -- matching-tag )

tags-named ( tag name/string -- tags-seq )
deep-tag-named ( tag name/string -- matching-tag )
deep-tags-named ( tag name/string -- tags-seq )
get-id ( tag id -- elem )

To get at the contents of a single tag, use

children>string ( tag -- string )

children-tags ( tag -- sequence )
first-child-tag ( tag -- child )
assert-tag ( name name -- )