1XML::Stream::Namespace(U3s)er Contributed Perl DocumentatXiMoLn::Stream::Namespace(3)
2
3
4
6 XML::Stream::Namespace - Object to make defining Namespaces easier in
7 XML::Stream.
8
10 XML::Stream::Namespace is a helper package to XML::Stream. It provides
11 a clean way of defining Namespaces for XML::Stream to use when connect‐
12 ing.
13
15 This module allows you to set and read elements from an XML::Stream
16 Namespace.
17
19 SetNamespace("mynamespace");
20 SetXMLNS("http://www.mynamespace.com/xmlns");
21 SetAttributes(attrib1=>"value1",
22 attrib2=>"value2");
23
24 GetNamespace() returns "mynamespace"
25 GetXMLNS() returns "http://www.mynamespace.com/xmlns"
26 GetAttributes() returns a hash ( attrib1=>"value1",attrib2=>"value2")
27 GetStream() returns the following string:
28 "xmlns:mynamespace='http://www.nynamespace.com/xmlns'
29 mynamespace:attrib1='value1'
30 mynamespace:attrib2='value2'"
31
33 $myNamespace = new XML::Stream::Namespace("mynamspace");
34 $myNamespace->SetXMLNS("http://www.mynamespace.org/xmlns");
35 $myNamespace->SetAttributes(foo=>"bar",
36 bob=>"vila");
37
38 $stream = new XML::Stream;
39 $stream->Connect(name=>"foo.bar.org",
40 port=>1234,
41 namespace=>"foo:bar",
42 namespaces=>[ $myNamespace ]);
43
44 #
45 # The above Connect will send the following as the opening string
46 # of the stream to foo.bar.org:1234...
47 #
48 # <stream:stream
49 # xmlns:stream="http://etherx.jabber.org/streams"
50 # to="foo.bar.org"
51 # xmlns="foo:bar"
52 # xmlns:mynamespace="http://www.mynamespace.org/xmlns"
53 # mynamespace:foo="bar"
54 # mynamespace:bob="vila">
55 #
56
58 Written by Ryan Eatmon in February 2000 Idea By Thomas Charron in Janu‐
59 ary of 2000 for http://etherx.jabber.org/streams/
60
62 This module is free software; you can redistribute it and/or modify it
63 under the same terms as Perl itself.
64
65
66
67perl v5.8.8 2004-04-04 XML::Stream::Namespace(3)