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).
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:
stevenjamesf...
Member
73 Points
236 Posts
Adding Namespace (xmlns)
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.
Bonekrusher
Contributor
4027 Points
922 Posts
Re: Adding Namespace (xmlns)
Jan 21, 2008 06:48 PM|LINK
Hi,
Namespace declaration xsi is reserved for "http://www.w3.org/2001/XMLSchema-instance"
Is that your name space?
stevenjamesf...
Member
73 Points
236 Posts
Re: Adding Namespace (xmlns)
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).
Bonekrusher
Contributor
4027 Points
922 Posts
Re: Adding Namespace (xmlns)
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.
stevenjamesf...
Member
73 Points
236 Posts
Re: Adding Namespace (xmlns)
Jan 21, 2008 09:27 PM|LINK
I don't mean to sound ungrateful, but how does that answer my initial question?
Bonekrusher
Contributor
4027 Points
922 Posts
Re: Adding Namespace (xmlns)
Jan 21, 2008 09:38 PM|LINK
No problem.
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.
Bones
stevenjamesf...
Member
73 Points
236 Posts
Re: Adding Namespace (xmlns)
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:
<ReleaseOrder xmlns="http://www.w3.org/2001/XMLSchema-instance">
<Identity TransactionKey="080114100015980" TransactionDate="2008-01-21" TransactionTime="02:23:45" xmlns="">
<SenderName>TEST</SenderName>
<SenderNumber>0</SenderNumber>
<SharedSecret>xxxx</SharedSecret>
<CompanyNumber>01</CompanyNumber>
<CustomerNumber>7038452</CustomerNumber>
<ExternalUserID />
</Identity>
Bonekrusher
Contributor
4027 Points
922 Posts
Re: Adding Namespace (xmlns)
Jan 21, 2008 11:33 PM|LINK
hmm can you post the code you use to create the XML from the Dataset?
stevenjamesf...
Member
73 Points
236 Posts
Re: Adding Namespace (xmlns)
Jan 21, 2008 11:40 PM|LINK
Aside from populating some tables, this is how it goes from DataSet to Xml:
wf1OrderDs.DataSetName =
"ReleaseOrder"wf1OrderDs.Namespace =
"http://www.w3.org/2001/XMLSchema-instance" Dim wf1OrderXml As New System.Xml.XmlDataDocument(wf1OrderDs)Bonekrusher
Contributor
4027 Points
922 Posts
Re: Adding Namespace (xmlns)
Jan 22, 2008 03:38 PM|LINK
I would loose this line:
wf1OrderDs.Namespace = "http://www.w3.org/2001/XMLSchema-instance"
its not needed.