SYNOPSISxmlNs xmlTreeNewNs(xmlNode element, string prefix, string URI)
Parameters:
parent
- the element that will be parent of this xmlNsprefix
- 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:
xmlNs
of the new namespace
DESCRIPTIONxmlTreeNewNs()
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 ALSOxmlTreeNewElement
,
xmlTreeNewPI
,
xmlTreeNewText
,
xmlTreeNewCDATA
,
xmlTreeNewComment
,
xmlTreeNewAttribute