Boulder::XML generates BoulderIO streams from XML files and/or
streams. It is also able to output Boulder Stones in XML format. Its
semantics are similar to those of Boulder::Stream, except that there
is never any pass-through behavior.
Because XML was not designed for streaming, some care must be taken
when reading an XML document into a series of Stones. Consider this
<?xml version="1.0" standalone="yes"?>
<Date>September 29, 1999</Date>
<Copyright copyrighted="yes">1999 Lincoln Stein</Copright>
This is the abstract. It is not anything very fancy,
but it will do.
<Journal>Journal of Irreproducible Results</Journal>
<Journal>Journal of Aesthetic Surgery</Journal>
Ordinarily the document will be construed as a single Paper tag
containing subtags Author, Date, Copyright, Abstract, and so on.
However it might be desirable to fetch out just the citation tags as a
series of Stones. In this case, you can declare Citation to be the
top level tag by passing the <B>-tagB> argument to new(). Now calling
get() will return each of the three Citation sections in turn. If no
tag is explicitly declared to be the top level tag, then Boulder::XML
will take the first tag it sees in the document.
It is possible to stream XML files. You can either separate them into
separate documents and use the automatic ARGV processing features of
the BoulderIO library, or separate the XML documents using a
<B>delimiterB> string similar to the delimiters used in MIME multipart
documents. By default, BoulderIO uses a delimiter of
<B>This is not a general XML parsing engine!B> Instead, it is a way to
represent BoulderIO tag/value streams in XML format. The module uses
XML::Parser to parse the XML streams, and therefore any syntactic
error in the stream can cause the XML parser to quit with an error.
Another thing to be aware of is that there are certain XML
constructions that will not translate into BoulderIO format, specifically
free text that contains embedded tags. This is OK:
but this is not:
<Author>The <Emphatic>extremely illustrious</Emphatic> Jean Siao</Author>
In BoulderIO format, tags can contain other tags or text, but cannot
contain a mixture of tags and text.