NAME
Net::XMPP2::Node - XML node tree helper for the parser.
SYNOPSIS
use Net::XMPP2::Node;
...
DESCRIPTION
This class represens a XML node. Net::XMPP2 should usually not require messing with the parse tree, but sometimes it is neccessary.
If you experience any need for messing with these and feel Net::XMPP2 should rather take care of it drop me a mail, feature request or most preferably a patch!
Every Net::XMPP2::Node has a namespace, attributes, text and child nodes.
You can access these with the following methods:
METHODS
- new ($ns, $el, $attrs, $parser)
-
Creates a new Net::XMPP2::Node object with the node tag name
$elin the namespace URI$nsand the attributes$attrs. The$parsermust be the instance ofNet::XMPP2::Parserwhich generated this node. - name
-
The tag name of this node.
- namespace
-
Returns the namespace URI of this node.
- eq ($namespace_or_alias, $name) or eq ($node)
-
Returns true whether the current element matches the tag name
$namein the namespaces pointed at by$namespace_or_alias.You can either pass an alias that was defined in Net::XMPP2::Namespaces or pass an namespace URI in
$namespace_or_alias. If no alias with the name$namespace_or_aliaswas found in Net::XMPP2::Namespaces it will be interpreted as namespace URI.The first argument to eq can also be another Net::XMPP2::Node instance.
- eq_ns ($namespace_or_alias) or eq_ns ($node)
-
This method return true if the namespace of this instance of Net::XMPP2::Node matches the namespace described by
$namespace_or_aliasor the namespace of the$nodewhich has to be another Net::XMPP2::Node instance.See
eqfor the meaning of$namespace_or_alias. - attr ($name)
-
Returns the contents of the
$nameattribute. - add_node ($node)
-
Adds a sub-node to the current node.
- nodes
-
Returns a list of sub nodes.
- add_text ($string)
-
Adds character data to the current node.
- text
-
Returns the text for this node.
- find_all (@path)
-
This method does a recursive descent through the sub-nodes and fetches all nodes that match the last element of
@path.The elements of
@pathconsist of a array reference to an array with two elements: the namespace key known by the$parserand the tagname we search for. - write_on ($writer)
-
This writes the current node out to the Net::XMPP2::Writer object in
$writer.
AUTHOR
Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>
COPYRIGHT & LICENSE
Copyright 2007 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.