ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Net-XMPP2/lib/Net/XMPP2/Namespaces.pm
Revision: 1.4
Committed: Fri Feb 9 20:23:06 2007 UTC (19 years, 8 months ago) by elmex
Branch: MAIN
Changes since 1.3: +11 -49 lines
Log Message:
removed unneccessary documentation and added neglected documentation.

File Contents

# Content
1 package Net::XMPP2::Namespaces;
2 use warnings;
3 use strict;
4 require Exporter;
5 our @EXPORT_OK = qw/xmpp_ns set_xmpp_ns_alias/;
6 our @ISA = qw/Exporter/;
7
8 our %NAMESPACES = (
9 client => 'jabber:client',
10 stream => 'http://etherx.jabber.org/streams',
11 streams => 'urn:ietf:params:xml:ns:xmpp-streams',
12 stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas',
13 sasl => 'urn:ietf:params:xml:ns:xmpp-sasl',
14 bind => 'urn:ietf:params:xml:ns:xmpp-bind',
15 tls => 'urn:ietf:params:xml:ns:xmpp-tls',
16 roster => 'jabber:iq:roster',
17 version => 'jabber:iq:version',
18 session => 'urn:ietf:params:xml:ns:xmpp-session',
19 xml => 'http://www.w3.org/XML/1998/namespace',
20 disco_info => 'http://jabber.org/protocol/disco#info',
21 );
22
23 =head1 NAME
24
25 Net::XMPP2::Namespaces - A XMPP namespace collection and aliasing class
26
27 =head1 SYNOPSIS
28
29 use Net::XMPP2::Namespaces qw/xmpp_ns set_xmpp_ns_alias/;
30
31 set_xmpp_ns_alias (stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas');
32 $node->find_all ($p, [xmpp_ns ('stanzas'), 'iq']);
33
34 =head1 DESCRIPTION
35
36 This module represents a simple namespaces aliasing mechanism to ease handling
37 of namespaces when traversing Net::XMPP2::Node objects and writing XML
38 with Net::XMPP2::Writer.
39
40 =head1 XMPP NAMESPACES
41
42 There are already some aliases defined for the XMPP XML namespaces
43 which make handling of namepsaces a bit easier:
44
45 stream => http://etherx.jabber.org/streams
46 xml => http://www.w3.org/XML/1998/namespace
47
48 streams => urn:ietf:params:xml:ns:xmpp-streams
49 session => urn:ietf:params:xml:ns:xmpp-session
50 stanzas => urn:ietf:params:xml:ns:xmpp-stanzas
51 sasl => urn:ietf:params:xml:ns:xmpp-sasl
52 bind => urn:ietf:params:xml:ns:xmpp-bind
53 tls => urn:ietf:params:xml:ns:xmpp-tls
54
55 client => jabber:client
56 roster => jabber:iq:roster
57 version => jabber:iq:version
58
59 =head1 FUNCTIONS
60
61 =head2 xmpp_ns ($alias)
62
63 Returns am uri for the registered C<$alias> or undef if none exists.
64
65 =cut
66
67 sub xmpp_ns { return $NAMESPACES{$_[0]} }
68
69 =head2 set_xmpp_ns_alias ($alias, $namespace_uri)
70
71 Sets an C<$alias> for the C<$namespace_uri>.
72
73 =cut
74
75 sub set_xmpp_ns_alias { return $NAMESPACES{$_[0]} }
76
77 =head1 AUTHOR
78
79 Robin Redeker, C<< <elmex at ta-sa.org> >>
80
81 =head1 COPYRIGHT & LICENSE
82
83 Copyright 2007 Robin Redeker, all rights reserved.
84
85 This program is free software; you can redistribute it and/or modify it
86 under the same terms as Perl itself.
87
88 =cut
89
90 1; # End of Net::XMPP2