XML::Parser::Style::Elemental(3User Contributed Perl DocumentatXML::Parser::Style::Elemental(3pm)
NAME
XML::Parser::Style::Elemental - A flexible and extensible object tree style for
XML::Parser. DEPRECATED.
SYNOPSIS
#!/usr/bin/perl -w
use XML::Parser;
use Data::Dumper;
my $p = XML::Parser->new( Style => 'Elemental' );
my $doc = <<DOC;
<foo>
<bar key="value">The world is foo enough.</bar>
</foo>
DOC
my ($e) = $p->parse($doc);
print Data::Dumper->Dump( [$e] );
my $test_node = $e->contents->[0];
print "root: " . $test_node->root . " is " . $e . "\n";
print "text content of " . $test_node->name . "\n";
print $test_node->text_content;
DESCRIPTION
This module is similar to the XML::Parser Objects style (See XML::Parser::Style::Objects,
but a bit more advanced and flexible. While the Objects style creates simple hash objects
for each node, Elemental uses a set of generic classes with accessors that can be
subclassed. This parser style is also namespace aware and work with custom objects that
provide additional functionality whether they be subclasses of the XML::Elemental objects
or written from scratch with the same core method signatures. (See "REGISTERING CUSTOM
CLASSES")
Originally this parser style used a dynamic class factory to create objects with accessor
methods if other classes were not specified. This behaviour has been deprecated in favor
of using the simple static classes found in the XML::Elemental package.
OPTIONS
Elemental specific options are set in the XML::Parser constructor through a hash element
with a key of 'Elemental', The value of Elemental is expected to be a hash reference with
one of more of the option keys detailed in the following sections.
REGISTERING CUSTOM CLASSES
If you require something more functional then the generic set of classes provided you can
register your own with Elemental. Like the Elemental class types, the option keys are
"Document", "Element" and "Characters".
my $p = XML::Parser->new(
Style => 'Elemental',
Namespace => 1,
Elemental => {
Document => 'Foo::Doc',
Element => 'Foo::El',
Characters => 'Foo::Chars'
}
);
XML::Elemental provides a collection of very simple generic objects that can be subclassed
to add more functionality while continuing to use the Elemental parser style. Developers
are free to create their own modules from scratch. All that is required is that they
support the same core method signatures of the XML:Elemental classes. (See
XML::Elemental::Document, XML::Elemental::Element and XML::Elemental::Characters and their
abstract base class XML::Elemental::Node.)
NO_WHITESPACE
When set to true, "No_Whitespace" causes Elemental to pass over character strings of all
whitespace instead of creating a new Character object. This options is helpful in
stripping out extraneous non-markup characters that are commonly introduced when
formatting XML to be human readable.
This method is a bit crude a simplistic. Eventually this module will support the
"xml:space" attribute and related functionality to processing whitespace.
SEE ALSO
XML::Parser::Style::Objects, XML::Elemental
TO DO
o Implement xml:space support and related functionality.
AUTHOR & COPYRIGHT
Please see the XML::Elemental manpage for author, copyright, and license information.
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
Around line 85:
=begin without a target?
Around line 178:
'=item' outside of any '=over'
Around line 180:
You forgot a '=back' before '=head1'
Around line 187:
'=end' without a target?
perl v5.10.0 2008-01-06 XML::Parser::Style::Elemental(3pm)
Generated by $Id: phpMan.php,v 4.49 2006/02/26 13:18:18 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2012-05-25 11:10 @38.107.179.238 Crawled by CCBot/1.0 (+http://www.commoncrawl.org/bot.html)