PRB: DOMDocument.CreateNode() Method Appends an Empty Namespace Declaration (290485)
The information in this article applies to:
- Microsoft XML 2.5
- Microsoft XML 2.6
- Microsoft XML 3.0
- Microsoft XML 3.0 SP1
- Microsoft XML 4.0
This article was previously published under Q290485 SYMPTOMS
Creating an eXtensible Markup Language (XML) element by using the MSXML DOMDocument.CreateNode() method and appending it as a child node of another element that references a specified default namespace generates an empty namespace declaration [xmlns=""] for the newly created and appended child element.
CAUSE
This behavior is by design. It occurs only when the parent node references a specified default namespace, and a blank string is supplied as the namespaceURI parameter of the DOMDocument.CreateNode() method that is used to create the child element. The blank string supplied as the namespaceURI parameter is treated as the explicit default namespace for the child element.
RESOLUTION
Specify the parent element's namespaceURI as the namespaceURI parameter of the DOMDocument.CreateNode() method to indicate that the parent's namespaceURI applies to the child, and to prevent the generation of the empty namespace declaration for the child element.
Modification Type: | Major | Last Reviewed: | 10/13/2001 |
---|
Keywords: | kbDSupport kbprb KB290485 kbAudDeveloper |
---|
|