1XML::LibXML::Namespace(U3s)er Contributed Perl DocumentatXiMoLn::LibXML::Namespace(3)
2
3
4
6 XML::LibXML::Namespace - XML::LibXML Namespace Implementation
7
9 use XML::LibXML;
10 # Only methods specific to Namespace nodes are listed here,
11 # see XML::LibXML::Node manpage for other methods
12
13 my $ns = XML::LibXML::Namespace->new($nsURI);
14 print $ns->nodeName();
15 print $ns->name();
16 $localname = $ns->getLocalName();
17 print $ns->getData();
18 print $ns->getValue();
19 print $ns->value();
20 $known_uri = $ns->getNamespaceURI();
21 $known_prefix = $ns->getPrefix();
22
24 Namespace nodes are returned by both
25 $element->findnodes('namespace::foo') or by $node->getNamespaces().
26
27 The namespace node API is not part of any current DOM API, and so it is
28 quite minimal. It should be noted that namespace nodes are not a sub
29 class of XML::LibXML::Node, however Namespace nodes act a lot like
30 attribute nodes, and similarly named methods will return what you would
31 expect if you treated the namespace node as an attribute. Note that in
32 order to fix several inconsistencies between the API and the
33 documentation, the behavior of some functions have been changed in
34 1.64.
35
37 new
38 my $ns = XML::LibXML::Namespace->new($nsURI);
39
40 Creates a new Namespace node. Note that this is not a 'node' as an
41 attribute or an element node. Therefore you can't do call all
42 XML::LibXML::Node Functions. All functions available for this node
43 are listed below.
44
45 Optionally you can pass the prefix to the namespace constructor. If
46 this second parameter is omitted you will create a so called
47 default namespace. Note, the newly created namespace is not bound
48 to any document or node, therefore you should not expect it to be
49 available in an existing document.
50
51 declaredURI
52 Returns the URI for this namespace.
53
54 declaredPrefix
55 Returns the prefix for this namespace.
56
57 nodeName
58 print $ns->nodeName();
59
60 Returns "xmlns:prefix", where prefix is the prefix for this
61 namespace.
62
63 name
64 print $ns->name();
65
66 Alias for nodeName()
67
68 getLocalName
69 $localname = $ns->getLocalName();
70
71 Returns the local name of this node as if it were an attribute,
72 that is, the prefix associated with the namespace.
73
74 getData
75 print $ns->getData();
76
77 Returns the URI of the namespace, i.e. the value of this node as if
78 it were an attribute.
79
80 getValue
81 print $ns->getValue();
82
83 Alias for getData()
84
85 value
86 print $ns->value();
87
88 Alias for getData()
89
90 getNamespaceURI
91 $known_uri = $ns->getNamespaceURI();
92
93 Returns the string "http://www.w3.org/2000/xmlns/"
94
95 getPrefix
96 $known_prefix = $ns->getPrefix();
97
98 Returns the string "xmlns"
99
101 Matt Sergeant, Christian Glahn, Petr Pajas
102
104 2.0018
105
107 2001-2007, AxKit.com Ltd.
108
109 2002-2006, Christian Glahn.
110
111 2006-2009, Petr Pajas.
112
113
114
115perl v5.16.3 2013-05-13 XML::LibXML::Namespace(3)