NAME

XML::RSS::Parser::Element -- a simple object that holds one node in the XML::RSS::Parser parse tree.

DESCRIPTION

XML::RSS::Parser::Element is a simple object that holds one node in the parse tree. Roughly based on XML::SimpleObject.

METHODS

XML::RSS::Parser::Element->new( [\%init] )

Constructor for XML::RSS::Parser::Element. Optionally the name, value, attributes, root, and parent can be set with a HASH reference using keys of the same name. See their associated functions below for more.

$element->root( [$feed] )

Returns a reference to the root element of the parse tree. A XML::RSS::Parser::Feed can be passed to optionally set the root element. The default is undefined.

$element->parent( [$element] )

Returns a reference to the parent element. A XML::RSS::Parser::Element object or one of its subclasses can be passed to optionally set the parent. The default is undefined.

$element->name( [$extended_name] )

Returns the name of the element as a SCALAR. This should by the fully namespace qualified (extended) name of the element and not the QName or local part. The default is undefined.

$element->value( [$value] )

Returns a reference to the value (text contents) of the element. If an optional SCALAR parameter is passed in the value (text contents) is set. Returns a null string if not set.

$element->append_value( $value )

Appends the value of the SCALAR parameter to the object's current value. A convenience method that is particularly helpful when working in XML::Parser handlers.

$element->attribute($name [, $value] )

Returns the value of an attribute specified by $name as a SCALAR. If an optional second text parameter $value is passed in the attribute is set. Returns undef if the attribute does not exist.

$element->attributes( [\%attributes] )

Returns a HASH reference contain attributes and their values as key value pairs. An optional parameter of a HASH reference can be passed in to set multiple attributes. Returns undef if no attributes exist. NOTE: When setting attributes with this method, all existing attributes are overwritten irregardless of whether they are present in the hash being passed in.

$element->child( [$extended_name] )

Constructs and returns a new element object making the current object as its parent. An optional parameter representing the name of the new element object can be passed. This should be the fully namespace qualified (extended) name and not the QName or local part. Returns undef if the child is not present.

$element->children( [$extended_name] )

Returns any array of child elements to the object. An optional parameter can be passed in to return element(s) with a specific name. If called in a SCALAR context it will return only the first element with this name. If called in an ARRAY context the function returns all elements with this name. If no elements exist as a child of the object, and undefined value is returned.

$element->children_names

Returns an array containing the names of the objects children. Empty if no children are present.

XPath-esque Methods

$element->query($xpath)

Finds matching nodes using an XPath-esque query from anywhere in the tree. See the Class::XPath documentation for more information.

$element->match($xpath)

Alias for the query method. For compatability. query is preferred.

$element->xpath

Returns a unique XPath string to the current node which can be used as an identifier.

SEE ALSO

XML::RSS::Parser, XML::SimpleObject, Class::XPath

AUTHOR & COPYRIGHT

Please see the XML::RSS::Parser manpage for author, copyright, and license information.

6 POD Errors

The following errors were encountered while parsing the POD:

Around line 133:

=begin without a target?

Around line 147:

'=item' outside of any '=over'

Around line 222:

You forgot a '=back' before '=head2'

Around line 224:

'=item' outside of any '=over'

Around line 240:

You forgot a '=back' before '=head1'

Around line 251:

'=end' without a target?