Any better way to generate the XML file for InfoPath?

T

TJ

First of all, I am not designing infopath form from SQL
server.
As you know, in the infopath form, after you filled out
the form, you can save it as XML file.
This is one example of saved XML file.

PART A is just indicator that I put to make you understand
better...


<?xml version="1.0" encoding="UTF-8"?>

------ PART A ----------------------

<?mso-infoPathSolution solutionVersion="1.0.0.65"
productVersion="11.0.6357" PIVersion="1.0.0.0"
href="file:///C:\A.xsn" name="urn:schemas-microsoft-
com:eek:ffice:infopath:A:-myXSD-2004-08-24T18-27-40" ?><?mso-
application progid="InfoPath.Document"?><my:myFields
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003
/myXSD/2004-08-24T18:27:40"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003
" xml:lang="en">

---- PART A END --

<my:Quantity_01>1</my:Quantity_01>
....
</my:myFields>

From this saved XML file, I can open the infopath form
with the saved data.

Here is what I want...

I would like to generate like this saved XML file from my
SQL server data so that this generated XML file can be
opend in infopath program.
I would think that I can write code for data part
xml....,however, how am I supposed to generate the PART A
part? I think that without generating PART A, infopath
program cannot recognize whether this xml file is for
infopath program or not...
Should I write "HARD-CODED" manually for PART A? Or is
there any functionality that I can use to generate PART A
automatically in the C# .NET?...If so, how I can use the
functionality so that I can focus to generate only for my
own form data?

I hope you can understand my issue...

Thank you in advance.

...................................TJ
 
T

TJ

Hi,

Thanks for your answer.
I am just wondering whether InfoPath SDK(or any other
SDK?) provides some exposed objects to generate thest kind
of processing-instructions eaiser for developer....
If so, could you give me some reference url that I can
look at?

Thanks again.

.................................................TJ
-----Original Message-----
You definitely need PART A if you want your generated XML
file to be able to open directly into InfoPath.
Hard-coding it is not a good idea, as items may change.
Certain parts can be hard-coded:
Processing-instruction #1:
* Items 1, 6, 7 can be hard coded.
* Item 2 is the version of your form template and should be kept up-to-date.
* Item 3 is the version of the InfoPath application, and should be kept up-to-date.
* Item 4 - I'm not sure, but I believe this can be hard
coded. At least it shouldn't change very often.
* Item 5 is the location of your form template. It can be
hard coded, but must be updated if the template is moved.
1. <?mso-infoPathSolution
2. solutionVersion="1.0.0.65"
3. productVersion="11.0.6357"
4. PIVersion="1.0.0.0"
5. href="file:///C:\A.xsn"
6. name="urn:schemas-microsoft-com:eek:ffice:infopath:A:- myXSD-2004-08-24T18-27-40"
7. ?>


Processing-instruction #2:
* All items (1-3) can be hard coded.
1. <?mso-application
2. progid="InfoPath.Document"
3. ?>


Root node:
* Item 1 is the name of your root node. It can be hard
coded unless you change it in your schema / data source.
* Items 2-6 can be hard coded.
1. <my:myFields
2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3. xmlns:my="http://schemas.microsoft.com/office/infopath/2003
/myXSD/2004-08-24T18:27:40"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003
"
5. xml:lang="en"
6. >


Hope this has helped!

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



"TJ" <[email protected]> wrote in
message news:[email protected]...
 

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