CreateElementNodeNS - cXMLDOMDocument

Creates an XML Element node that is namespace aware

Type: Function

Return Data Type: Handle

Parameters: String sNameSpace String sTagName String sValue

sNameSpaceThe element NamespaceURI
sTagNameThe element tag name
sValueThe element's value

Return Value

If successful, the function returns an object handle for the newly created node. If zero is returned, the operation failed. If a node is returned, it is your responsibility to eventually destroy the object (e.g. Send Destroy of hoMyCreatedNode).

Function CreateElementNodeNS String sNameSpace String sTagName String sValue Returns Handle

Call: Get CreateElementNodeNS sNameSpace sTagName sValue to HandleVariable


CreateElementNodeNS creates an node object for the element type. This function creates an XML node but does not add it to the XML document. Nodes can be created and appended in a single step using the Add... messages.

All XML objects created using any of the CreateXxxxx methods will create the DataFlex object as a child of the main document node (the cXmlDomDocumentObject). The actual hierarchy of your XML document has nothing to do with this object placement. The messages AppendNode, InsertBeforeNode and CloneNode determine placement of an XML node object within the document, where the object receiving the message will become the parent node.


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 CreateElementNodeNS and not CreateElementNode).

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) | AddElementNS(get) | CreateDocumentElementNS | CreateAttributeNodeNS | AddAttributeNS