.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" 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
.\" ========================================================================
.\"
.IX Title "XML::Parser::Lite::Tree 3pm"
.TH XML::Parser::Lite::Tree 3pm "2022-11-19" "perl v5.36.0" "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::Parser::Lite::Tree \- Lightweight XML tree builder
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use XML::Parser::Lite::Tree;
\&
\& my $tree_parser = XML::Parser::Lite::Tree::instance();
\& my $tree = $tree_parser\->parse($xml_data);
\&
\& OR
\&
\& my $tree = XML::Parser::Lite::Tree::instance()\->parse($xml_data);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This is a singleton class for parsing \s-1XML\s0 into a tree structure. How does this
differ from other \s-1XML\s0 tree generators? By using XML::Parser::Lite, which is a
pure perl \s-1XML\s0 parser. Using this module you can tree-ify simple \s-1XML\s0 without
having to compile any C.
.PP
For example, the following \s-1XML:\s0
.PP
.Vb 1
\& hoopla
.Ve
.PP
Parses into the following tree:
.PP
.Vb 10
\& {
\& \*(Aqchildren\*(Aq => [
\& {
\& \*(Aqchildren\*(Aq => [
\& {
\& \*(Aqchildren\*(Aq => [],
\& \*(Aqattributes\*(Aq => {
\& \*(Aqa\*(Aq => \*(Aqb\*(Aq,
\& \*(Aqc\*(Aq => \*(Aqd\*(Aq
\& },
\& \*(Aqtype\*(Aq => \*(Aqelement\*(Aq,
\& \*(Aqname\*(Aq => \*(Aqbar\*(Aq
\& },
\& {
\& \*(Aqcontent\*(Aq => \*(Aqhoopla\*(Aq,
\& \*(Aqtype\*(Aq => \*(Aqtext\*(Aq
\& }
\& ],
\& \*(Aqattributes\*(Aq => {
\& \*(Aqwoo\*(Aq => \*(Aqyay\*(Aq
\& },
\& \*(Aqtype\*(Aq => \*(Aqelement\*(Aq,
\& \*(Aqname\*(Aq => \*(Aqfoo\*(Aq
\& }
\& ],
\& \*(Aqtype\*(Aq => \*(Aqroot\*(Aq
\& };
.Ve
.PP
Each node contains a \f(CW\*(C`type\*(C'\fR key, one of \f(CW\*(C`root\*(C'\fR, \f(CW\*(C`element\*(C'\fR and \f(CW\*(C`text\*(C'\fR. \f(CW\*(C`root\*(C'\fR is the
document root, and only contains an array ref \f(CW\*(C`children\*(C'\fR. \f(CW\*(C`element\*(C'\fR represents a normal
tag, and contains an array ref \f(CW\*(C`children\*(C'\fR, a hash ref \f(CW\*(C`attributes\*(C'\fR and a string \f(CW\*(C`name\*(C'\fR.
\&\f(CW\*(C`text\*(C'\fR nodes contain only a \f(CW\*(C`content\*(C'\fR string.
.SH "METHODS"
.IX Header "METHODS"
.ie n .IP """instance()""" 4
.el .IP "\f(CWinstance()\fR" 4
.IX Item "instance()"
Returns an instance of the tree parser.
.ie n .IP """new( options... )""" 4
.el .IP "\f(CWnew( options... )\fR" 4
.IX Item "new( options... )"
Creates a new parser. Valid options include \f(CW\*(C`process_ns\*(C'\fR to process namespaces.
.ie n .IP """parse($xml)""" 4
.el .IP "\f(CWparse($xml)\fR" 4
.IX Item "parse($xml)"
Parses the xml in \f(CW$xml\fR and returns the tree as a hash ref.
.SH "AUTHOR"
.IX Header "AUTHOR"
Copyright (C) 2004\-2008, Cal Henderson,
.SH "SEE ALSO"
.IX Header "SEE ALSO"
XML::Parser::Lite.