XML, the Perl Way

Home XML::Twig Modules Talks Articles Tutorials Reports Tools PGC mirod Le Blog print
Processing XML with Perl Michel Rodriguez

Stream Processing

Filtering vs Extracting

Tree processing

The other main model is the tree model: A whole document is parsed and loaded in memory as a tree. The tree can then be queried, updated and if needed output as XML.

The tree can either be a complex data structure (arrays of arrays of array... as in XML::Parser in Tree style or XML::Simple) or a "real tree" (as in XML::DOM, XML::XPath or XML::Twig).

Navigation in a "real" tree is often done using the child/sibling metaphor. Modifications is done using the cut/paste metaphor.

Pros

Cons

Usually development will be faster and the software more robust, as working with a tree is usually easier for programmers than dealing with a stream.



Stream Processing

Filtering vs Extracting