No matter why or how they were put together or to what purpose
they'll be applied, all XML documents must follow
the same basic rules of well-formedness: exactly one root element, no
overlapping elements, all attributes quoted, and so on. Every XML
processor's parser component will, at its core, need
to do the same things as every other XML processor. This, in turn,
means that all these processors can share a common base. Perl
XML-processing programs usually observe this in their use of one of
the many free parsing modules, rather than having to reimplement
basic XML parsing procedures every time.
Furthermore, the one-document, one-element nature of XML makes
processing a pleasantly fractal experience, as any document invoked
through an external entity by another document magically becomes
"just another element" within the
invoker, and the same code that crawled the first document can
skitter into the meat of any reference (and anything to which the
reference might refer) without batting an eye.