SetChildElementValueNS - cXMLDOMDocument

Creates or replaces a child element which matches the passed NamespaceURI and BaseName and sets the element's text value

Type: Procedure

Parameters: string sNameSpaceURI string sBaseName String sValue

sNamespaceURINamespace-URI string (e.g.
sBaseNameName of Element excluding the prefix
sValueThe value of the Element's text

Procedure SetChildElementValueNS string sNameSpaceURI string sBaseName String sValue

Call: Send SetChildElementValueNS sNameSpaceURI sBaseName sValue


SetChildElementValueNS can be used to search for a child element and replace its value. The first element that matches the passed sNamespaceURI and sBaseName will be found and its text value will be replaced with sValue. If a child element is not found, it will be created and appended to the node's list of child objects.

The method will be used when you need to find a simple element (i.e, an element that only contains text) and change its text value.

This sample will search for an element named "Status" and replace its text value with "x".

Move "" to sNS
Send SetChildElementValueNS of hoCustomer sNS "Status"  "x"


This message creates a node and a document that is namespace aware. This requires that you always pass a NameSpaceURI. It is suggested that you always create documents using namespace methods (the methods that end in NS) and that you no longer use the non-namespace methods (e.g. use SetChildElementValueNS and not SetChildNodeValue).

If your document does not have any namespaces or an element within the document does not have a namespace, its namespace is considered to be global and its NamespaceURI is represented as an empty string (""). In such a case you can and should use these namespace aware messages passing an empty string for the NameSpaceURI.

See Also

AddElementNS(send) | AddElement(get) | ChildElementValueNS | ChildElementNS | NextElementNS