3 XML::LibXML::Namespace - XML::LibXML Namespace Implementation
10 # Only methods specific to Namespace nodes are listed here,
11 # see XML::LibXML::Node manpage for other methods
13 my $ns = XML::LibXML::Namespace->new($nsURI);
14 print $ns->nodeName();
16 $localname = $ns->getLocalName();
18 print $ns->getValue();
20 $known_uri = $ns->getNamespaceURI();
21 $known_prefix = $ns->getPrefix();
25 Namespace nodes are returned by both $element->findnodes('namespace::foo') or
26 by $node->getNamespaces().
28 The namespace node API is not part of any current DOM API, and so it is quite
29 minimal. It should be noted that namespace nodes are I<<<<<< not >>>>>> a sub class of L<<<<<< XML::LibXML::Node >>>>>>, however Namespace nodes act a lot like attribute nodes, and similarly named
30 methods will return what you would expect if you treated the namespace node as
31 an attribute. Note that in order to fix several inconsistencies between the API
32 and the documentation, the behavior of some functions have been changed in
42 my $ns = XML::LibXML::Namespace->new($nsURI);
44 Creates a new Namespace node. Note that this is not a 'node' as an attribute or
45 an element node. Therefore you can't do call all L<<<<<< XML::LibXML::Node >>>>>> Functions. All functions available for this node are listed below.
47 Optionally you can pass the prefix to the namespace constructor. If this second
48 parameter is omitted you will create a so called default namespace. Note, the
49 newly created namespace is not bound to any document or node, therefore you
50 should not expect it to be available in an existing document.
55 Returns the URI for this namespace.
60 Returns the prefix for this namespace.
65 print $ns->nodeName();
67 Returns "xmlns:prefix", where prefix is the prefix for this namespace.
79 $localname = $ns->getLocalName();
81 Returns the local name of this node as if it were an attribute, that is, the
82 prefix associated with the namespace.
89 Returns the URI of the namespace, i.e. the value of this node as if it were an
95 print $ns->getValue();
107 =item getNamespaceURI
109 $known_uri = $ns->getNamespaceURI();
111 Returns the string "http://www.w3.org/2000/xmlns/"
116 $known_prefix = $ns->getPrefix();
118 Returns the string "xmlns"
137 2001-2007, AxKit.com Ltd.
139 2002-2006, Christian Glahn.
141 2006-2009, Petr Pajas.