"Parsing an XML document into tree structures makes it
possible to operate on the tree structure of the data. Find out how
to use the functions for accessing and manipulating the document
tree, and follow a sample stock-trading application that uses Perl,
DOM, XML, and a database to evaluate trading rules. (You can
apply the same techniques with other scripting languages, including
Tcl and Python.) This is the second installment on using scripting
languages to manipulate and transform XML documents."
"My previous article discussed how to manipulate XML with
scripting languages, and Perl in particular. In the course of
parsing a file that way, handlers are called as each tag is
encountered. That provides a very efficient means of processing
XML, both in memory usage and processing time. However, certain
tasks are difficult to accomplish in the event-based methodology.
Imagine, for example, needing to move or rearrange certain segments
of the document or sorting items within the document. Because the
document is processed as a stream, we would first need to store the
components before sorting or rearranging them. A mechanism that
would store the components automatically would make such tasks
"XML documents are required to be well-balanced, making it easy
to store them as trees. Once you parse XML documents into tree
structures, you can then operate on the tree. This yields a great
deal of flexibility in dealing with the documents: you can access
the components of the document in random order, rearrange them, and
add or remove them. This is especially appropriate for applications
in which the flow of processing is based on external logic, as
opposed to the order and occurance of elements within the XML
document. Storing the document as a tree enables random access to
its data and structure, instead of having the processing governed
by when and where the tags and elements occur."
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.