| Processing XML with Perl | | Michel Rodriguez |
![]() Introduction to XML transformation | | ![]() Stream Processing |
Trees vs Streams
XML documents are usually modelled as trees:
doc
|
-------------------------
| | |
title section section
| | |
| ---------------
| | | |
text title para para
| | |
text text ------------
| | |
text bold text
|
text
Note that in the tree model text nodes (PCDATA or CDATA) are separate nodes and not attached to the enclosing element.
So there are 2 main models to process those documents: stream and tree
Other models are possible, such as Rax, a record-oriented model, or the XML::Twig model which mixes tree and stream.
![]() Introduction to XML transformation | | ![]() Stream Processing |


