1Parser::Style::Tree(3)User Contributed Perl DocumentationParser::Style::Tree(3)
2
3
4

NAME

6       XML::Parser::Style::Tree - Tree style parser
7

SYNOPSIS

9         use XML::Parser;
10         my $p = XML::Parser->new(Style => 'Tree');
11         my $tree = $p->parsefile('foo.xml');
12

DESCRIPTION

14       This module implements XML::Parser's Tree style parser.
15
16       When parsing a document, "parse()" will return a parse tree for the
17       document. Each node in the tree takes the form of a tag, content pair.
18       Text nodes are represented with a pseudo-tag of "0" and the string that
19       is their content. For elements, the content is an array reference. The
20       first item in the array is a (possibly empty) hash reference containing
21       attributes. The remainder of the array is a sequence of tag-content
22       pairs representing the content of the element.
23
24       So for example the result of parsing:
25
26         <foo><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>
27
28       would be:
29                    Tag   Content
30         ==================================================================
31         [foo, [{}, head, [{id => "a"}, 0, "Hello ",  em, [{}, 0, "there"]],
32                     bar, [         {}, 0, "Howdy",  ref, [{}]],
33                       0, "do"
34               ]
35         ]
36
37       The root document "foo", has 3 children: a "head" element, a "bar"
38       element and the text "do". After the empty attribute hash, these are
39       represented in it's contents by 3 tag-content pairs.
40
41
42
43perl v5.28.1                      2014-12-11            Parser::Style::Tree(3)
Impressum