xmlTreeNewNs

SYNOPSIS

xmlNs xmlTreeNewNs(xmlNode element, string prefix, string URI)

Parameters:

  • parent - the element that will be parent of this xmlNs

  • prefix - the prefix for the new namespace. '' may be used to indicate no prefix.

  • URI - the URI for the new namespace. '' may be used for the default, empty namespace.

Returns:

  • the xmlNs of the new namespace


DESCRIPTION
xmlTreeNewNs() creates a new namespace declaration on element. This xmlNs can then be assigned to nodes via xmlTreeSetNs() to put nodes in that namespace.


EXAMPLE
Given an XML document

<rootNode>
    <item>stuff</item>
</rootNode>

calling the following

<$root = (xmlTreeGetRootElement($doc))>
    <$ns = (xmlTreeNewNs($root, 'ts',
        'http://www.thunderstone.com'))>
    <$ret = (xmlTreeSetNs($root, $ns))>

and printing the doc will produce

<ts:rootNode xmlns:ts="http://www.thunderstone.com">
    <item>stuff</item>
</ts:rootNode>


SEE ALSO
xmlTreeNewElement, xmlTreeNewPI, xmlTreeNewText, xmlTreeNewCDATA, xmlTreeNewComment, xmlTreeNewAttribute


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