<fz****@calamos.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
I am relatively new to XML and C#. So, forgive me if this question is
too newbie. :-)
While assuming this is an easy programming task, I couldn't find a
single reference anywhere for how to do it. Here is the situation:
I am given an XML file like the one below from other group in my
company to load the data into our database.
<root xmlns="the-namespace">
...
data here...
...
</root>
I was able to load the file into an XmlDocument object and then into db
tables only when I removed 'xmlns="the-namespace'. However, if I
didn't remove it, The dataset in the XmlDocument was empty and there
was no exception thrown. I'd like to find a way of programmatically
removing the xmlns attribute. BTW, the namespace in the file was not
referenced anywhere in the XML document.
Thanks in advance.
Frank
Namespaces in XML are used in exactly the same way as namespaces in C#, to
disambiguate things.
Imagine you had an XML document descibing river navigation you much have an
element called "channel". If you have a document about TV programs you might
have an element called "channel". The problem comes when you have a document
about a TV program about river navigation - how do you tell the two channel
elements apart? XML namespaces.
There are two syntaxes for XML namespaces: one explicitly sets elements into
the namespace
<x:program xmlns:x="uri-TV">
<x:channel />
</x:program>
the other does it implicitly
<program xmlns="uri-TV>
<channel />
</program>
in the second example the program and channel elements are in the namespace
because the namespace is said to be the default for program element and all
its children.
Now to your question: what makes you think that the XML document you hahve
received hasn't been loaded into your XmlDocument instance?
Also you are using the terms DataSet and XmlDocument seemingly
interchangeably - where does the DataSet some from?
Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog http://www.dotnetconsult.co.uk