Commit | Line | Data |
3fea05b9 |
1 | =head1 NAME |
2 | |
3 | XML::LibXML::Namespace - XML::LibXML Namespace Implementation |
4 | |
5 | =head1 SYNOPSIS |
6 | |
7 | |
8 | |
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 | |
23 | =head1 DESCRIPTION |
24 | |
25 | Namespace nodes are returned by both $element->findnodes('namespace::foo') or |
26 | by $node->getNamespaces(). |
27 | |
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 |
33 | 1.64. |
34 | |
35 | |
36 | =head1 METHODS |
37 | |
38 | =over 4 |
39 | |
40 | =item new |
41 | |
42 | my $ns = XML::LibXML::Namespace->new($nsURI); |
43 | |
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. |
46 | |
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. |
51 | |
52 | |
53 | =item declaredURI |
54 | |
55 | Returns the URI for this namespace. |
56 | |
57 | |
58 | =item declaredPrefix |
59 | |
60 | Returns the prefix for this namespace. |
61 | |
62 | |
63 | =item nodeName |
64 | |
65 | print $ns->nodeName(); |
66 | |
67 | Returns "xmlns:prefix", where prefix is the prefix for this namespace. |
68 | |
69 | |
70 | =item name |
71 | |
72 | print $ns->name(); |
73 | |
74 | Alias for nodeName() |
75 | |
76 | |
77 | =item getLocalName |
78 | |
79 | $localname = $ns->getLocalName(); |
80 | |
81 | Returns the local name of this node as if it were an attribute, that is, the |
82 | prefix associated with the namespace. |
83 | |
84 | |
85 | =item getData |
86 | |
87 | print $ns->getData(); |
88 | |
89 | Returns the URI of the namespace, i.e. the value of this node as if it were an |
90 | attribute. |
91 | |
92 | |
93 | =item getValue |
94 | |
95 | print $ns->getValue(); |
96 | |
97 | Alias for getData() |
98 | |
99 | |
100 | =item value |
101 | |
102 | print $ns->value(); |
103 | |
104 | Alias for getData() |
105 | |
106 | |
107 | =item getNamespaceURI |
108 | |
109 | $known_uri = $ns->getNamespaceURI(); |
110 | |
111 | Returns the string "http://www.w3.org/2000/xmlns/" |
112 | |
113 | |
114 | =item getPrefix |
115 | |
116 | $known_prefix = $ns->getPrefix(); |
117 | |
118 | Returns the string "xmlns" |
119 | |
120 | |
121 | |
122 | =back |
123 | |
124 | =head1 AUTHORS |
125 | |
126 | Matt Sergeant, |
127 | Christian Glahn, |
128 | Petr Pajas |
129 | |
130 | |
131 | =head1 VERSION |
132 | |
133 | 1.70 |
134 | |
135 | =head1 COPYRIGHT |
136 | |
137 | 2001-2007, AxKit.com Ltd. |
138 | |
139 | 2002-2006, Christian Glahn. |
140 | |
141 | 2006-2009, Petr Pajas. |
142 | |
143 | =cut |