xmlTreeGetNs

 

SYNOPSIS

    xmlNs xmlTreeGetNs(xmlNode node)

Parameters:

  • node - the element/attribute you want to get the namespace of

Returns:

  • the assigned namespace for node


DESCRIPTION
xmlTreeGetNs() gets the assigned namespace for an element or attribute.

Note that this is the namespace that applies to the node, which may be created on a different node, and there may be other namespaces declared on this node that this node isn't assigned to.

For example, for the XML data

<top xmlns:ex="http://www.example.com">
    <ex:item xmlns:ts="http://www.thunderstone.com"
             xmlns:web="http://www.webinator.com"/>
</top>

calling xmlTreeGetNs() on the <item> node would return the xmlNs for the http://www.example.com namespace, as that is what <item> is assigned to (as opposed to the other two namespaces that are declared on the <item> element).

To get the namespace(s) declared on an element, use xmlTreeGetNsDef().


EXAMPLE

    <$ns = (xmlTreeGetNs($node))>
    <$prefix = (xmlTreeGetNsPrefix($ns))>
    <$URI = (xmlTreeGetNsURI($ns))>
    namespace $URI uses the prefix $prefix


SEE ALSO
xmlTreeGetNsDef


Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.