F
fzhang
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>
The particular namespace may mean something to the people who generate
the xml data schema and data files but nothing to us.
Here is my code (we have a schema and a data files ready for data
loading)
........
m_xDataDoc = new XmlDataDocument();
Debug.Assert(m_xDataDoc != null);
m_xDataDoc.DataSet.ReadXmlSchema(m_SchemaFile);
Debug.Assert(m_DataFile != null);
m_xDataDoc.Load(m_DataFile);
........
If I don't remove the namespace by hand in the data file,
m_xDataDoc.DataSet is empty. If I
manually remove the namespace, m_xDataDoc.DataSet properly contains
data from the XML file.
While I understand 'namespace' and its usage, I would just like to
know if we can programmatically (instead of manually) remove the
namespace to make the data (XML) file loadable.
Thanks in advance.
Frank
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>
The particular namespace may mean something to the people who generate
the xml data schema and data files but nothing to us.
Here is my code (we have a schema and a data files ready for data
loading)
........
m_xDataDoc = new XmlDataDocument();
Debug.Assert(m_xDataDoc != null);
m_xDataDoc.DataSet.ReadXmlSchema(m_SchemaFile);
Debug.Assert(m_DataFile != null);
m_xDataDoc.Load(m_DataFile);
........
If I don't remove the namespace by hand in the data file,
m_xDataDoc.DataSet is empty. If I
manually remove the namespace, m_xDataDoc.DataSet properly contains
data from the XML file.
While I understand 'namespace' and its usage, I would just like to
know if we can programmatically (instead of manually) remove the
namespace to make the data (XML) file loadable.
Thanks in advance.
Frank