Lite::Element(3)

NAME
XML::Lite::Element - A class representing an XML element in an XML::Lite document

SYNOPSIS
use XML::Lite; my $xml = new XML::Lite( -xml => 'a_file.xml' ); my $elm = $xml->elements_by_name( 'element_name' ); print $elm->get_attribute( 'attribute_name' );

DESCRIPTION
`XML::Lite::Element' objects contain rudimentary methods for querying XML elements in an XML document as parsed by XML::Lite. Usually these objects are returned by method calls in XML::Lite.

METHODS
The following methods are available. All methods like 'get_name' can be abbeviated as 'name.'

my $element = new XML::Lite::Element( $owner_document, \@pointers );
    Creates a new XML::Lite::Element object from the XML::Lite object, `$owner_document'.

    Currently, you must not call this manually. You can create an object with one of the 'factory' methods in XML::Lite, such as `element_by_name' or `root_element' or with one of the XML::Lite::Element 'factory' methods below, like `get_children'.

my $content = $element->get_content()
    Returns the content of the XML element. This may include other XML tags. The entire content is returned as a scalar.

my %attributes = $element->get_attributes()
    Returns a hash of name - value pairs for the attributes in this element.

my $value = $element->get_attribute( $name )
    Returns the value of the named attribute for this element.

my $name = $element->get_name()
    Returns the name of the element tag

my @children = $element->get_children()
    Returns a list of XML::Lite::Element objects for each element contained within the current element. This does not return any text or CDATA in the content of this element. You can parse that through the the get_content manpage method.

    If no child elements exist then an empty list is returned.

my $text = $element->get_text()
    Returns a scalar of the text within an element sans children elements. This effectively takes the content of the element and strips all XML elements. All text is concatenated into a single string. White space is preserved. CDATA elements are included without the <![CDATA[ tags. Other entities are preserved.

VERSION
0.14

AUTHOR
Jeremy Wadsack for Wadsack-Allen Digital Group (dgsupport@wadsack-allen.com)

COPYRIGHT
Copyright 2001 Wadsack-Allen. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.