93 lines
2.7 KiB
HTML
93 lines
2.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Parser::Style::Tree</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Parser::Style::Tree</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-10-03<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
XML::Parser::Style::Tree - Tree style parser
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use XML::Parser;
|
|
my $p = XML::Parser->new(Style => 'Tree');
|
|
my $tree = $p->parsefile('foo.xml');
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
This module implements XML::Parser's Tree style parser.
|
|
<P>
|
|
|
|
When parsing a document, <TT>"parse()"</TT> will return a parse tree for the
|
|
document. Each node in the tree
|
|
takes the form of a tag, content pair. Text nodes are represented with
|
|
a pseudo-tag of ``0'' and the string that is their content. For elements,
|
|
the content is an array reference. The first item in the array is a
|
|
(possibly empty) hash reference containing attributes. The remainder of
|
|
the array is a sequence of tag-content pairs representing the content
|
|
of the element.
|
|
<P>
|
|
|
|
So for example the result of parsing:
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
<foo><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
would be:
|
|
<BR> Tag Content
|
|
<BR> ==================================================================
|
|
<BR> [foo, [{}, head, [{id => ``a''}, 0, ``Hello '', em, [{}, 0, ``there'']],
|
|
<BR> bar, [ {}, 0, ``Howdy'', ref, [{}]],
|
|
<BR> 0, ``do''
|
|
<BR> ]
|
|
<BR> ]
|
|
<P>
|
|
|
|
The root document ``foo'', has 3 children: a ``head'' element, a ``bar''
|
|
element and the text ``do''. After the empty attribute hash, these are
|
|
represented in it's contents by 3 tag-content pairs.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:01 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|