{
    "mode": "perldoc",
    "parameter": "XML::Stream::Namespace",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AStream%3A%3ANamespace/json",
    "generated": "2026-06-12T06:37:37Z",
    "synopsis": "XML::Stream::Namespace is a helper package to XML::Stream. It provides a clean way of defining\nNamespaces for XML::Stream to use when connecting.",
    "sections": {
        "NAME": {
            "content": "XML::Stream::Namespace - Object to make defining Namespaces easier in XML::Stream.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "XML::Stream::Namespace is a helper package to XML::Stream. It provides a clean way of defining\nNamespaces for XML::Stream to use when connecting.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module allows you to set and read elements from an XML::Stream\nNamespace.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "SetNamespace(\"mynamespace\");\nSetXMLNS(\"http://www.mynamespace.com/xmlns\");\nSetAttributes(attrib1=>\"value1\",\nattrib2=>\"value2\");\n\nGetNamespace() returns \"mynamespace\"\nGetXMLNS() returns \"http://www.mynamespace.com/xmlns\"\nGetAttributes() returns a hash ( attrib1=>\"value1\",attrib2=>\"value2\")\nGetStream() returns the following string:\n\"xmlns:mynamespace='http://www.nynamespace.com/xmlns'\nmynamespace:attrib1='value1'\nmynamespace:attrib2='value2'\"\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "$myNamespace = XML::Stream::Namespace->new(\"mynamspace\");\n$myNamespace->SetXMLNS(\"http://www.mynamespace.org/xmlns\");\n$myNamespace->SetAttributes(foo=>\"bar\",\nbob=>\"vila\");\n\n$stream = XML::Stream->new;\n$stream->Connect(name=>\"foo.bar.org\",\nport=>1234,\nnamespace=>\"foo:bar\",\nnamespaces=>[ $myNamespace ]);\n\n#\n# The above Connect will send the following as the opening string\n# of the stream to foo.bar.org:1234...\n#\n#   <stream:stream\n#    xmlns:stream=\"http://etherx.jabber.org/streams\"\n#    to=\"foo.bar.org\"\n#    xmlns=\"foo:bar\"\n#    xmlns:mynamespace=\"http://www.mynamespace.org/xmlns\"\n#    mynamespace:foo=\"bar\"\n#    mynamespace:bob=\"vila\">\n#\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Written by Ryan Eatmon in February 2000 Idea By Thomas Charron in January of 2000 for\nhttp://etherx.jabber.org/streams/\n\nCurrently maintained by Darian Anthony Patrick.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/\n\nThis module licensed under the LGPL, version 2.1.\n",
            "subsections": []
        }
    },
    "summary": "XML::Stream::Namespace - Object to make defining Namespaces easier in XML::Stream.",
    "flags": [],
    "examples": [
        "$myNamespace = XML::Stream::Namespace->new(\"mynamspace\");",
        "$myNamespace->SetXMLNS(\"http://www.mynamespace.org/xmlns\");",
        "$myNamespace->SetAttributes(foo=>\"bar\",",
        "bob=>\"vila\");",
        "$stream = XML::Stream->new;",
        "$stream->Connect(name=>\"foo.bar.org\",",
        "port=>1234,",
        "namespace=>\"foo:bar\",",
        "namespaces=>[ $myNamespace ]);",
        "# The above Connect will send the following as the opening string",
        "# of the stream to foo.bar.org:1234...",
        "#   <stream:stream",
        "#    xmlns:stream=\"http://etherx.jabber.org/streams\"",
        "#    to=\"foo.bar.org\"",
        "#    xmlns=\"foo:bar\"",
        "#    xmlns:mynamespace=\"http://www.mynamespace.org/xmlns\"",
        "#    mynamespace:foo=\"bar\"",
        "#    mynamespace:bob=\"vila\">"
    ],
    "see_also": []
}