.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" 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 >0, 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 "XML::Struct::Reader 3pm" .TH XML::Struct::Reader 3pm "2019-02-21" "perl v5.28.1" "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" XML::Struct::Reader \- Read XML streams into XML data structures .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $reader = XML::Struct::Reader\->new( from => "file.xml" ); \& my $data = $reader\->read; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module reads an \s-1XML\s0 stream (via XML::LibXML::Reader) into XML::Struct/MicroXML data structures. .SH "METHODS" .IX Header "METHODS" .ie n .SS "read = readNext ( [ $stream ] [, $path ] )" .el .SS "read = readNext ( [ \f(CW$stream\fP ] [, \f(CW$path\fP ] )" .IX Subsection "read = readNext ( [ $stream ] [, $path ] )" Read the next \s-1XML\s0 element from a stream. If no path option is specified, the reader's path option is used ("\f(CW\*(C`*\*(C'\fR" by default, first matching the root, then every other element). .ie n .SS "readDocument( [ $stream ] [, $path ] )" .el .SS "readDocument( [ \f(CW$stream\fP ] [, \f(CW$path\fP ] )" .IX Subsection "readDocument( [ $stream ] [, $path ] )" Read an entire \s-1XML\s0 document. In contrast to \f(CW\*(C`read\*(C'\fR/\f(CW\*(C`readNext\*(C'\fR, this method always reads the entire stream. The return value is the first element (that is the root element by default) in scalar context and a list of elements in array context. Multiple elements can be returned for instance when a path was specified to select document fragments. .ie n .SS "readElement( [ $stream ] )" .el .SS "readElement( [ \f(CW$stream\fP ] )" .IX Subsection "readElement( [ $stream ] )" Read an \s-1XML\s0 element from a stream and return it as array reference with element name, attributes, and child elements. In contrast to method \f(CW\*(C`read\*(C'\fR, this method expects the stream to be at an element node (\f(CW\*(C`$stream\->nodeType == 1\*(C'\fR) or bad things might happed. .ie n .SS "readAttributes( [ $stream ] )" .el .SS "readAttributes( [ \f(CW$stream\fP ] )" .IX Subsection "readAttributes( [ $stream ] )" Read all \s-1XML\s0 attributes from a stream and return a (possibly empty) hash reference. .ie n .SS "readContent( [ $stream ] )" .el .SS "readContent( [ \f(CW$stream\fP ] )" .IX Subsection "readContent( [ $stream ] )" Read all child elements of an \s-1XML\s0 element and return the result as (possibly empty) array reference. Significant whitespace is only included if option \&\f(CW\*(C`whitespace\*(C'\fR is enabled. .SH "CONFIGURATION" .IX Header "CONFIGURATION" .IP "from" 4 .IX Item "from" A source to read from. Possible values include a string or string reference with \s-1XML\s0 data, a filename, an \s-1URL,\s0 a file handle, instances of XML::LibXML::Document or XML::LibXML::Element, and a hash reference with options passed to XML::LibXML::Reader. .IP "stream" 4 .IX Item "stream" A XML::LibXML::Reader to read from. If no stream has been defined, one must pass a stream parameter to the \f(CW\*(C`read...\*(C'\fR methods. Setting a source with option \&\f(CW\*(C`from\*(C'\fR automatically sets a stream. .IP "attributes" 4 .IX Item "attributes" Include attributes (enabled by default). If disabled, the representation of an \s-1XML\s0 element will be .Sp .Vb 1 \& [ $name => \e@children ] .Ve .Sp instead of .Sp .Vb 1 \& [ $name => \e%attributes, \e@children ] .Ve .IP "path" 4 .IX Item "path" Optional path expression to be used as default value when calling \f(CW\*(C`read\*(C'\fR. Pathes must either be absolute (starting with "\f(CW\*(C`/\*(C'\fR\*(L") or consist of a single element name. The special name \*(R"\f(CW\*(C`*\*(C'\fR" matches all element names. .Sp A path is a very reduced form of an XPath expressions (no axes, no "\f(CW\*(C`..\*(C'\fR", no node tests, \f(CW\*(C`//\*(C'\fR only at the start...). Namespaces are not supported yet. .IP "whitespace" 4 .IX Item "whitespace" Include ignorable whitespace as text elements (disabled by default) .IP "ns" 4 .IX Item "ns" Define how \s-1XML\s0 namespaces should be processed. By default (value '\f(CW\*(C`keep\*(C'\fR'), this document: .Sp .Vb 3 \& \& \& .Ve .Sp is transformed to this structure, keeping namespace prefixes and declarations as unprocessed element names and attributes: .Sp .Vb 8 \& [ \*(Aqdoc\*(Aq, {}, [ \& [ \& \*(Aqx:foo\*(Aq, { \& \*(Aqbar\*(Aq => \*(Aqdoz\*(Aq, \& \*(Aqxmlns:x\*(Aq => \*(Aqhttp://example.org/\*(Aq \& } \& ] \& ] .Ve .Sp Setting this option to '\f(CW\*(C`strip\*(C'\fR' will remove all namespace prefixes and namespace declaration attributes, so the result would be: .Sp .Vb 7 \& [ \*(Aqdoc\*(Aq, {}, [ \& [ \& \*(Aqfoo\*(Aq, { \& \*(Aqbar\*(Aq => \*(Aqdoz\*(Aq \& } \& ] \& ] .Ve .Sp Setting this option to '\f(CW\*(C`disallow\*(C'\fR' results in an error when namespace prefixes or declarations are read. .Sp Expanding namespace URIs ('\f(CW\*(C`expand\*(Aq\*(C'\fR) is not supported yet. .IP "simple" 4 .IX Item "simple" Convert \s-1XML\s0 to simple key-value structure (SimpleXML) with XML::Struct::Simple. .IP "depth" 4 .IX Item "depth" Only transform to a given depth, starting at \f(CW0\fR for the root node. Negative values, non-numeric values or \f(CW\*(C`undef\*(C'\fR are ignored (unlimited depth as default). .Sp \&\s-1XML\s0 elements below the depth are converted to SimpleXML by default or to MicroXML if option \f(CW\*(C`simple\*(C'\fR is enabled. This can be configured with option \&\f(CW\*(C`deep\*(C'\fR. .Sp This option is useful for instance to access document-oriented \s-1XML\s0 embedded in data oriented \s-1XML.\s0 .IP "deep" 4 .IX Item "deep" How to transform elements below given \f(CW\*(C`depth\*(C'\fR. This option is experimental. .IP "root" 4 .IX Item "root" Include root element when converting to SimpleXML. Disabled by default. .IP "content" 4 .IX Item "content" Name of text content when converting to SimpleXML.