NAME

XML::Handler::ExtOn::Element - Class for Element object.

SYNOPSYS

use XML::Handler::ExtOn;
my $buf;
my $wrt = XML::SAX::Writer->new( Output => \$buf );
my $ex_parser = new XML::Handler::ExtOn:: Handler => $wrt;

...

#create Element
my $elem = $ex_parser->mk_element("Root");
$elem->add_content( $elem->mk_element("tag1"));

...

#delete tag from XML
$elem->delete_element;

...

#delete tag from XML and skip content
$elem->delete_element->skip_content;

...

#set default namespace( scoped in element )
$elem->add_namespace(''=>"http://example.com/defaultns");

...

#get attribites by prefix
my $hash_ref = $elem->attrs_by_prefix('myprefix');
$hash_ref->{attr1} = 1;

$ex_parser->start_element($elem)
$ex_parser->end_element;

METHODS

add_content <element object1>[, <element object2> ...]

Add commands to contents stack.Return $self

$elem->add_content( 
    $self->mk_from_xml("<p/>"),
    $self->mk_cdata("TEST CDATA"),
    )

mk_element <tag name>

Create element object in namespace of element.

add_namespace <Prefix> => <Namespace_URI>, [ <Prefix1> => <Namespace_URI1>, ... ]

Add Namespace mapping. return $self

If Prefix eq '', this namespace will then apply to all elements that have no prefix.

$elem->add_namespace(
    "myns" => 'http://example.com/myns',
    "myns_test", 'http://example.com/myns_test',
    ''=>'http://example.com/new_default_namespace'
);

default_uri

Return default Namespace_URI for Element scope.

local_name

Return localname of elemnt ( without prefix )

attrs_by_prefix <Prefix>

Return reference to hash of attributes for Prefix.

attrs_by_prefix <Namespace_URI>

Return reference to hash of attributes for Namespace_URI.

attrs_by_name

Return reference to hash of attributes by name.

skip_content

Skip entry of element. Return $self

is_skip_content

Return 1 - if element marked to skip content

delete_element, delete

Delete start and close element from stream. return $self

is_delete_element

Return 1 - if element marked to delete

SEE ALSO

XML::Handler::ExtOn, XML::SAX::Base

AUTHOR

Zahatski Aliaksandr, <zag@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007-2008 by Zahatski Aliaksandr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.