.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Boulder::XML 3pm" .TH Boulder::XML 3pm "2015-06-17" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Boulder::XML \- XML format input/output for Boulder streams .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Boulder::XML; \& \& $stream = Boulder::XML\->newFh; \& \& while ($stone = <$stream>) { \& print $stream $stone; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Boulder::XML generates BoulderIO streams from \s-1XML\s0 files and/or streams. It is also able to output Boulder Stones in \s-1XML\s0 format. Its semantics are similar to those of Boulder::Stream, except that there is never any pass-through behavior. .PP Because \s-1XML\s0 was not designed for streaming, some care must be taken when reading an \s-1XML\s0 document into a series of Stones. Consider this \&\s-1XML\s0 document: .PP .Vb 1 \& \& \& \& Lincoln Stein \& Jean Siao \& September 29, 1999 \& 1999 Lincoln Stein \& \& This is the abstract. It is not anything very fancy, \& but it will do. \& \& \& Fitchberg J \& Journal of Irreproducible Results \& 23 \& 1998 \& \& \& Clemenson V \& Ecumenica \& 10 \& 1968 \& \& \& Ruggles M \& Journal of Aesthetic Surgery \& 10 \& 1999 \& \& .Ve .PP 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 \fB\-tag\fR argument to \fInew()\fR. Now calling \&\fIget()\fR 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. .PP It is possible to stream \s-1XML\s0 files. You can either separate them into separate documents and use the automatic \s-1ARGV\s0 processing features of the BoulderIO library, or separate the \s-1XML\s0 documents using a \&\fBdelimiter\fR string similar to the delimiters used in \s-1MIME\s0 multipart documents. By default, BoulderIO uses a delimiter of . .PP \&\fBThis is not a general \s-1XML\s0 parsing engine!\fR Instead, it is a way to represent BoulderIO tag/value streams in \s-1XML\s0 format. The module uses XML::Parser to parse the \s-1XML\s0 streams, and therefore any syntactic error in the stream can cause the \s-1XML\s0 parser to quit with an error. Another thing to be aware of is that there are certain \s-1XML\s0 constructions that will not translate into BoulderIO format, specifically free text that contains embedded tags. This is \s-1OK:\s0 .PP .Vb 1 \& Jean Siao .Ve .PP but this is not: .PP .Vb 1 \& The extremely illustrious Jean Siao .Ve .PP In BoulderIO format, tags can contain other tags or text, but cannot contain a mixture of tags and text. .SS "\s-1CONSTRUCTORS\s0" .IX Subsection "CONSTRUCTORS" .ie n .IP "$stream = Boulder::XML\->new(*IN,*OUT);" 4 .el .IP "\f(CW$stream\fR = Boulder::XML\->new(*IN,*OUT);" 4 .IX Item "$stream = Boulder::XML->new(*IN,*OUT);" .PD 0 .ie n .IP "$stream = Boulder::XML\->new(\-in=>*IN, \-out=>*OUT, \-tag=>$tag, \-delim=>$delim, \-strip=>$strip)" 4 .el .IP "\f(CW$stream\fR = Boulder::XML\->new(\-in=>*IN, \-out=>*OUT, \-tag=>$tag, \-delim=>$delim, \-strip=>$strip)" 4 .IX Item "$stream = Boulder::XML->new(-in=>*IN, -out=>*OUT, -tag=>$tag, -delim=>$delim, -strip=>$strip)" .PD \&\fInew()\fR creates a new Boulder::XML stream that can be read from or written to. All arguments are optional. .Sp .Vb 3 \& \-in Filehandle to read from. \& If a file name is provided, will open the file. \& Defaults to the magic <> filehandle. \& \& \-out Filehandle to write to. \& If a file name is provided, will open the file for writing. \& Defaults to STDOUT \& \& \-tag The top\-level XML tag to consider as the Stone record. Defaults \& to the first tag seen when reading from an XML file, or to \& EStoneE when writing to an output stream without \& previously having read. \& \& \-delim Delimiter to use for delimiting multiple Stone objects in an \& XML stream. \& \& \-strip If true, automatically strips leading and trailing whitespace \& from text contained within tags. .Ve .ie n .IP "$fh = Boulder::XML\->newFh(*IN,*OUT);" 4 .el .IP "\f(CW$fh\fR = Boulder::XML\->newFh(*IN,*OUT);" 4 .IX Item "$fh = Boulder::XML->newFh(*IN,*OUT);" .PD 0 .ie n .IP "$fh = Boulder::XML\->newFh(\-in=>*IN, \-out=>*OUT, \-tag=>$tag, \-delim=>$delim, \-strip=>$strip)" 4 .el .IP "\f(CW$fh\fR = Boulder::XML\->newFh(\-in=>*IN, \-out=>*OUT, \-tag=>$tag, \-delim=>$delim, \-strip=>$strip)" 4 .IX Item "$fh = Boulder::XML->newFh(-in=>*IN, -out=>*OUT, -tag=>$tag, -delim=>$delim, -strip=>$strip)" .PD The \fInewFh()\fR constructor creates a tied filehandle that can read and write Boulder::XML streams. Invoking <> on the filehandle will perform a \fIget()\fR, returning a Stone object. Calling \fIprint()\fR on the filehandle will perform a \fIput()\fR, writing a Stone object to output in \&\s-1XML\s0 format. .SS "\s-1METHODS\s0" .IX Subsection "METHODS" .ie n .IP "$stone = $stream\->\fIget()\fR" 4 .el .IP "\f(CW$stone\fR = \f(CW$stream\fR\->\fIget()\fR" 4 .IX Item "$stone = $stream->get()" .PD 0 .ie n .IP "$stream\->put($stone)" 4 .el .IP "\f(CW$stream\fR\->put($stone)" 4 .IX Item "$stream->put($stone)" .ie n .IP "$done = $stream\->done" 4 .el .IP "\f(CW$done\fR = \f(CW$stream\fR\->done" 4 .IX Item "$done = $stream->done" .PD All these methods have the same semantics as the similar methods in Boulder::Stream, except that pass-through behavior doesn't apply. .SH "AUTHOR" .IX Header "AUTHOR" Lincoln D. Stein , Cold Spring Harbor Laboratory, Cold Spring Harbor, \s-1NY. \s0 This module can be used and distributed on the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Boulder, Boulder::Stream, Stone