xmlTreeGetNsDef

SYNOPSIS

xmlNs[] xmlTreeGetNsDef(xmlNode element)

Parameters:

  • element - the element that you want to get the namespace declarations from

Returns:

  • the namespace declarations from element


DESCRIPTION
xmlTreeGetNsDef() gets the namespaces defined on the element element. For example, for the following 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 xmlTreeGetNsDef() on the <item> node would return the xmlNs for the http://www.thunderstone.com and http://www.webinator.com namespaces, as they are defined on <item>.

To get the namespace that applies to a node, use xmlTreeGetNs().


EXAMPLE

<$ns = (xmlTreeGetNsDef($node))>
    <loop $ns>
        <$prefix = (xmlTreeGetNsPrefix($ns))>
        <$URI = (xmlTreeGetNsURI($ns))>
        namespace $URI uses the prefix $prefix
    </loop>


SEE ALSO
xmlTreeGetNs


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.