xmlTreeLookupNsPrefix

SYNOPSIS

xmlNs xmlTreeLookupNsPrefix(xmlNode node, string prefix)

Parameters:

  • node - the xmlNode to lookup the namespace from

  • prefix - the prefix of the namespace to lookup

Returns:

  • the namespace that uses prefix


DESCRIPTION
xmlTreeLookupNsPrefix() looks up the namespace in the scope of node that uses the prefix prefix. Useful if you know that a namespace exists in the tree but you don't have the xmlNs of it.

This does not search the entire XML tree, but only the namespace scope of the given node, which is the current node and all nodes above it. If a namespace isn't available for a node to use, then it won't be found from a search on that node.

For example, given the following document:

<rootNode>
  <container xmlns:foo="http://www.example.com/container">
    <item1 xmlns:foo="http://www.example.com/item">text</item1>
    <item2>text</item2>
  </container>
  <item3>text</item3>
</rootNode>

If you look up the foo prefix from:


EXAMPLE

<$ns = (xmlTreeLookupNsPrefix($node, 'ts'))>


SEE ALSO
xmlTreeGetNsURI, xmlTreeGetNsPrefix, xmlTreeLookupNsURI


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