Re: XML Namespaces and ASP
Use the createElementNS method to create the elements. You also need to set some property of the XML serializer so that it will use xs as the namespace prefix for whatever namespace you use.
Re: XML Namespaces and ASP
Thanks for your help.
I tried changing the createNode line to
Code:
set root = xmldoc.createElementNS("http://test.com","xs:file")
But now I am getiing the message "Object doesn't support this property or method 'createElementNS'"
What do you mean by the "XML serializer"? I guess that this is what I am missing.
Thank you once again.
RKW
Re: XML Namespaces and ASP
Hmm - perhaps an outdated version of MSXML? Or MSHTML? Hmm...
Mind you, you'd only put "file", not "xs:file" as the element name.
As for XML serializer, well, what actually "produces" your result XML? The function calls create an in-memory representation. Somewhere there must be a serializer that turns that into actual XML.
Re: XML Namespaces and ASP
Sorry to be a pain, but if I just put "file" I get the same error message and how would it then know that I wanted to have "xs" as my namespace?
Can anyone see where I am going wrong? I am obviously missing something.
RKW
Re: XML Namespaces and ASP
Well, you would do this:
node = document.createElementNS("scheme:my_namespace_uri", "file");
And then there must be a place where you write the object tree into XML data. There you would have to configure it to map the namespace "scheme:my_namespace_uri" to the abbreviation "xs".
Re: XML Namespaces and ASP
I have returned to this problem and have still not solved it.
I keep getting the error "Object doesn't support this property or method: 'createElementNS'" whatever I do.
I am using MSXML 4.2. Can anybody help? Is there a way of doing this without using createElementNS?
Re: XML Namespaces and ASP
*checks*
*re-checks*
*blinks*
I can't believe it!
OK, the situation is, apparently, like this: MSXML sucks.
In other words, all of MSDN contains a single mention of createElementNS, and that's in an article about namespaces. Neither the IE object model reference, nor the .Net DOM reference, nor the MSXML reference contain any mention of this method. It seems to be completely unsupported. The .Net DOM provides an overload of the regular createElement method that does what the NS variant should do, apparently. However, the documentation is completely faulty and if this really what the method does, then it's completely broken.
Given this problem, you might want to look into an alternative to MSXML.
http://xml.apache.org/xerces-c/
Xerces-C++ has a COM wrapper that allows it to be used from VB. I'm afraid, however, that you'll have to build the library yourself in order to use it.
Re: XML Namespaces and ASP
Changing parser is not really an option, but thanks anyway.