Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Creates an element node using the specified name.
Syntax
HRESULT createElement( BSTR tagName, IDOMElement ** element);
Parameters
- tagName
- [in] Name for the new element node. The name is case sensitive. This name is subsequently available as the element node's nodeName property.
- element
- [out] Address of the IDOMElement interface for the new element.
Return Value
Returns S_OK if successful, or an error code otherwise.
Remarks
Although this method creates the new object in the context of this document, this method does not automatically add the new object to the document tree. In other words, although the ownerDocument property of the new node points to this document object, the parentNode property is set to NULL. You must explicitly call one of the node insert methods—insertBefore, replaceChild, or appendChild—to add the new object.
The nodeType has the value NODE_ELEMENT.
Note that you cannot specify the namespace within the tagName parameter. If the tagName is specified in the form xxx:yyy, the special meaning of the colon character is ignored and the colon is treated simply as a character within the tagName, creating an element with the base name xxx:yyy in the namespace of the document. The nameSpace property, which contains the namespace URI, is set to the empty string, "". You can only create a namespace-qualified node using the IXMLDOMDocument interface's createNode method.
See Also
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.