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