|
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:
-
<item1>, we'll get http://www.example.com/item -
<item2>, we'll get http://www.example.com/container -
<item3>, we'll get nothing, because the prefix foo
is not defined for <item3>'s scope.
EXAMPLE
<$ns = (xmlTreeLookupNsPrefix($node, 'ts'))>
SEE ALSO
xmlTreeGetNsURI,
xmlTreeGetNsPrefix,
xmlTreeLookupNsURI
Copyright © Thunderstone Software Last updated: Mon Feb 18 10:28:15 EST 2013
|