NAME
XML::Parser::Style::EasyTree - Parse xml to simple tree
VERSION
Version 0.01
SYNOPSIS
use XML::Parser;
my $p = XML::Parser->new( Style => 'EasyTree' );
EXAMPLE
will be
# ...
SPECIAL VARIABLES
$TEXT{ATTR} [ = '-' ]
Allow to set prefix for name of attribute nodes;
# will be
item => { -attr => 'value' };
# with
$TEXT{ATTR} = '+';
# will be
item => { '+attr' => 'value' };
$TEXT{NODE} [ = '#text' ]
Allow to set name for text nodes
- Text value
# will be
item => { sub => { -attr => "t" }, #text => 'Text value' };
# with
$TEXT{NODE} = '';
# will be
item => { sub => { -attr => "t" }, '' => 'Text value' };
%FORCE_ARRAY
Allow to force nodes to be represented always as arrays. If name is
empty string, then ot means ALL
- Text value
# will be
item => { sub => { -attr => "t" }, #text => 'Text value' };
# with
$FORCE_ARRAY{sub} = 1;
# will be
item => { sub => [ { -attr => "t" } ], #text => 'Text value' };
# with
$FORCE_ARRAY{''} = 1;
# will be
item => [ { sub => [ { -attr => "t" } ], #text => 'Text value' } ];
%FORCE_HASH
Allow to force text-only nodes to be represented always as hashes.
If name is empty string, then ot means ALL
- Text valueText value
# will be
item => { sub => 'Text value', any => 'Text value' };
# with
$FORCE_HASH{sub} = 1;
# will be
item => { sub => { #text => 'Text value' }, any => 'Text value' };
# with
$FORCE_HASH{''} = 1;
# will be
item => { sub => { #text => 'Text value' }, any => { #text => 'Text value' } };
@STRIP_KEY
Allow to strip something from tag names by regular expressions
Text value
# will be
'a:item' => { 'b:sub' => 'Text value' };
# with
@STRIP_KEY = (qr/^[^:]+:/);
# will be
'item' => { 'sub' => 'Text value' };
AUTHOR
Mons Anderson,
BUGS
None known
COPYRIGHT & LICENSE
Copyright 2009 Mons Anderson
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.