create infopath readable xml with VB NET

J

Jason Bailey

Hello,

I'm not sure if this should go to an infopath forum or a VB NET forum?

I'm trying to use Visual Basic .Net to open Infopath generated XML files;
make changes and re-save them as infopath readable XML. As a quick test:
I opened a sample xml file that I'd created with infopath; I also extracted
the infopath XSD file.
I loaded the XML data into a dataset
I changed no data
I created a new xml file based on the dataset and the XSD (infopath
generated) file

I tried:
myXmlDataDocument.DataSet.WriteXml("D:/sss.xml", XmlWriteMode.IgnoreSchema)
myXmlDataDocument.DataSet.WriteXml("D:/ttt.xml", XmlWriteMode.WriteSchema)

Both do indeed produce XML but neither open in Infopath

I found some good sample code at:
http://samples.gotdotnet.com/quickstart/howto/doc/Xml/LoadDataSetXMLData.aspx
(Load xml into a dataset)
and
http://samples.gotdotnet.com/quickstart/howto/doc/Xml/SaveDataSetXML.aspx
(Save a dataset to XML)

I'm not sure how much detail to go into but basically; I'd like to know if
I'm doing anything obviously wrong.

Looking at the new xml (using XmlWriteMode.WriteSchema) file it looks like
it's composed of schema and XML. and some of the complex data is missing.
Could someone point in the right direction of some code that will simply open
an infopath generated xml file, allow changes/edits and then resave to a new
or the same xml file. It seems to lose itself once I save xml from a dataset.
Actually the important thing appears to be that the complex data is missing.
I see now that XmlWriteMode.IgnoreSchema is just missing some instructions
(i.e. to use infopath <?mso-application progid="InfoPath.Document"?>) and
that XmlWriteMode.WriteSchema is both xml and schema in one file.

Is the dataset of visual basic ignoring my complex type xml data? Should I
be doing this in another way?

I have sample code and data.

Thanks for any advice

Jason
 
J

Jason Bailey

Is the dataset of visual basic ignoring my complex type xml data? Should I
be doing this in another way?

Actually I think this does it:
http://samples.gotdotnet.com/quickstart/howto/doc/Xml/SaveXmlDocument.aspx
I should use XML document instead of a dataset. Quite what that means at the
moment is a little beyond me.
The gotdotnet stuff is quite a good site for working out vb net and xml
stuff. I've now managed to take an infopath generated XML file, make a change
and then save to a new XML file which still opens in Infopath.

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top