Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 23, 2008 01:25 AM by Samu Zhang - MSFT
Jan 21, 2008 04:33 PM|LINK
I'm having trouble getting a namespace defined to an element in an XmlDataDocument object.
Specifically, I need to add xmlns:xsi="blah" to the top-level element and for some reason I just can't seem to get it right.
<topLevel xmlns:xsi="some namespace string">
I'm wondering if this has something to do with the fact that the Xml is question is in an XmlDataDocument instead of an XmlDocument.
Jan 21, 2008 06:48 PM|LINK
Namespace declaration xsi is reserved for "http://www.w3.org/2001/XMLSchema-instance"
Is that your name space?
Jan 21, 2008 06:57 PM|LINK
Yes, it is.
The XmlDataDocument is being created from a DataSet. I have set the DataSet's namespace according, but I don't know how to get the "xsi" in there.
I'm open to doing it in the DataSet, if possible, before I create the XmlDataDocument or after the XmlDataDocument is created (whichever method makes more sense).
Jan 21, 2008 08:40 PM|LINK
This usually means that you either have an element which has a child or children element(s) of a different namespace or a vis versa.
Jan 21, 2008 09:27 PM|LINK
I don't mean to sound ungrateful, but how does that answer my initial question?
Jan 21, 2008 09:38 PM|LINK
With out seeing your input xml and your output xml, thats all I can give you. POst a small sample of your input XML and output XML.
Jan 21, 2008 11:18 PM|LINK
There is no input Xml, the source is from a DataSet which is being transformed into an XmlDataDocument. If there is some way to modify the DataSet prior to creating the XmlDataDocument to acheive the desired result, that'd be great.
As for the Xml that is the result, a protion is below:
<Identity TransactionKey="080114100015980" TransactionDate="2008-01-21" TransactionTime="02:23:45" xmlns="">
Jan 21, 2008 11:33 PM|LINK
hmm can you post the code you use to create the XML from the Dataset?
Jan 21, 2008 11:40 PM|LINK
Aside from populating some tables, this is how it goes from DataSet to Xml:
Jan 22, 2008 03:38 PM|LINK
I would loose this line:
wf1OrderDs.Namespace = "http://www.w3.org/2001/XMLSchema-instance"
its not needed.