BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unwanted xmlsn="" attribute inserted by MSXML

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML
View previous topic :: View next topic  
Author Message
Ian Hinson
Guest





PostPosted: Sat Apr 22, 2006 8:03 pm    Post subject: Unwanted xmlsn="" attribute inserted by MSXML Reply with quote



Hi,
I'm using the DOMDocument wrapper component (created by importing msxml.dll
as MSXML_TLB) to produce an XML document programmatically.
But the output I get looks like this:
--------
<?xml version="1.0" encoding="ISO-8859-1"?>
<Root xmlns="http://mynamespace.com">
<Child xmlns="">value</Child>
</Root>
--------
The problem is the unwanted (xmlns="") attribute on the child node.

The code that produced this is listed below.
(Variable "dom" is a TDOMDocument component that wraps MS's
IXMLDOMDocument.)

var
instr: IXMLDOMProcessingInstruction;
root, node: IXMLDOMElement;
attr: IXMLDOMAttribute;
node: IXMLDOMElement;
begin
instr := dom.createProcessingInstruction('xml', 'version="1.0"
encoding="ISO-8859-1"');
dom.DefaultInterface.appendChild(instr);

root := dom.createElement('Root');
attr := dom.createAttribute('xmlns');
attr.value := 'http://mynamespace.com';
root.setAttributeNode(attr);
dom.DefaultInterface.appendChild(root);

root.appendChild(dom.createTextNode(#13#10#9));
node := dom.createElement('Child');
node.text := 'value';
root.appendChild(node);
root.appendChild(dom.createTextNode(#13#10));
dom.save('xml.txt');
end;

The problem does not occur if I remove the namespace attribute from the root
node.
Is this a problem with MS's implementation of IXMLDOMDocument in msxml.dll
or am I doing something wrong?

Thanks,
Ian
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.