NAME

XML::LibXML::Element - The DOM Element Class

SYNOPSIS

use XML::LibXML::Element;

$node = XML::LibXML::Element->new( $name )
$node->setAttribute( $aname, $avalue );
$node->setAttributeNS( $nsURI, $aname, $avalue );
$avalue = $node->getAttribute( $aname );
$avalue = $node->setAttributeNS( $nsURI, $aname );
$attrnode = $node->getAttributeNode( $aname );
$attrnode = $node->getAttributeNodeNS( $namespaceURI, $aname );
$node->removeAttribute( $aname );
$node->removeAttributeNS( $nsURI, $aname );
$boolean = $node->hasAttribute( $aname );
$boolean = $node->hasAttributeNS( $nsURI, $aname );
@nodes = $node->getElementsByTagName($tagname);
@nodes = $node->getElementsByTagNameNS($nsURI,$tagname);
$node->appendWellBalancedChunk( $chunk )
$node->appendText( $PCDATA );
$node->appendTextNode( $PCDATA );
$node->appendTextChild( $childname , $PCDATA )

DESCRIPTION

Methods

new

This function creates a new node unbound to any DOM.

setAttribute

This method sets or replaces the node's attribute $aname to the value $avalue

setAttributeNS

Namespaceversion of setAttribute .

getAttribute

If $node has an attribute with the name $aname , the value of this attribute will get returned.

getAttributeNS

Namespaceversion of getAttribute .

getAttributeNode

Returns the attribute as a node if the attribute exists. If the Attribute does not exists undef will be returned.

getAttributeNodeNS

Namespaceversion of getAttributeNode .

removeAttribute

The method removes the attribute $aname from the node's attribute list, if the attribute can be found.

removeAttributeNS

Namespace version of removeAttribute

hasAttribute

This funcion tests if the named attribute is set for the node. If the attribute is specified, TRUE (1) will be returned, otherwise the returnvalue is FALSE (0).

hasAttributeNS

namespace version of hasAttribute

getElementsByTagName

The function gives direct access to all childnodes of the current node with the same tagname. It makes things a lot easier if you need to handle big datasets. If this function is called in SCALAR context, it returns the number of Elements found.

getElementsByTagNameNS

Namespace version of getElementsByTagName . If this function is called in SCALAR context, it returns the number of Elements found.

appendWellBalancedChunk

Sometimes it is nessecary to append a string coded XML Tree to a node. appendWellBalancedChunk will do the trick for you. But this is only done if the String is well-balanced .

appendText

alias for appendTextNode().

appendTextNode

This wrapper function lets you add a string directly to an element node.

appendTextChild

Somewhat similar with appendTextNode : It lets you set an Element, that contains only a text node directly by specifying the name and the text content.

SEE ALSO

XML::LibXML, XML::LibXML::Node, XML::LibXML::Document, XML::LibXML::Attr, XML::LibXML::Text, XML::LibXML::Comment, XML::LibXML::DocumentFragment

VERSION

0.95