Exporting XML

W

wills.jason

Hi All,

a newbie here again.

before i start looking at infopath to design a form, i need to know if
when a user sublits a form i can get infopath to output a complted
form aswell as an xml file along side it containing all the user
entries..

can infopath do this for me?

if so can anyone point me in the right direction.

Many Thanks

Jason
 
K

Kevin Changet

There are a couple of things to note:
1) When you design an InfoPath form and "publish" it (make it available to
others to fill out), you end up creating a template file that ends with .xsn.
This file is really just a "CAB" file of all the different
XML/graphic/javascript files all put into one big file. Just like a Zip
file. (To see what I mean, rename a .xsn file to .cab and then open it with
your favorite zip utility). This .xsn file contains all the information on
how to present your underlying data. It doesn't contain the data, just the
definitions on how you want it to look when it's opened in InfoPath.

2) When users double click on this file, it will start up the InfoPath
client. Since this is only a template, there is no data, right? So now the
user can fill out the form and submit it.

3) Once the user submits it (can be to SharePoint, filesystem, etc.).
Infopath creates an XML file that just contains the data, the form structure,
and a hyperlink to the template file it was created from. This is a standard
XML file. You can open this in notepad and read it. If you were to email
this file to a friend, and the friend did not have both Infopath AND access
to the location of the template file, then the friend would not be able to
view it as an Infopath form. However, the friend would be able to open the
file in notepad and view the data and structure, just nothing else.

So to answer your question "i need to know if
when a user sublits a form i can get infopath to output a complted
form aswell as an xml file along side it containing all the user
entries.."

It will create an XML file containing all the user entries.
If the user doesn't have access to the template and an InfoPath client (or a
website with InfoPathServices), it won't look pretty. It will just look like
XML.
 
W

wills.jason

Thats great, thanks for pointing me in the right direction Kevin,

one question though... is there any way to change the format of the
XML? if i wanted the xml to have dirfferent tags etc?

Thanks for the help.

Jason
 
W

wills.jason

this is the output i'd ideally like to create when a user submits a
form,

=====================================================================================================================================================

<Entities>
<E Title="Sage MMS Data" Description="Group" Email=""
Members="1000,1015," Profiles="">
<E Title="Accounts" Description="Accounts Entity" Email=""
Members="1000," Profiles="1016,">
<I Title="Accounts Document" Description="Accounts
Documentation" Entity="!Accounts">
<T Title="Purchase Invoice" Description="Purchase
Invoice" Entity="!Accounts" InformationType="Accounts Document">
<A Title="Account Number" Description="Account
Number" AttributeType="String" Entity="!Accounts"
InformationType="Accounts Document" Template="Purchase Invoice"/>
<A Title="Sage Company Name" Description="Sage
Company Name" AttributeType="String" Entity="!Accounts"
InformationType="Accounts Document" Template="Purchase Invoice"/>
<A Title="Invoice Date" Description="Invoice Date"
AttributeType="DateTime" Entity="!Accounts" InformationType="Accounts
Document" Template="Purchase Invoice"/>
<A Title="Invoice Number" Description="Invoice
Number" AttributeType="String" Entity="!Accounts"
InformationType="Accounts Document" Template="Purchase Invoice"/>
<A Title="Second Reference" Description="Second
Reference" AttributeType="String" Entity="!Accounts"
InformationType="Accounts Document" Template="Purchase Invoice"/>
<A Title="Account Name" Description="Account Name"
AttributeType="String" Entity="!Accounts" InformationType="Accounts
Document" Template="Purchase Invoice"/>
<A Title="Invoice Due Date" Description="Invoice Due
Date" AttributeType="DateTime" Entity="!Accounts"
InformationType="Accounts Document" Template="Purchase Invoice"/>
</T>
</I>
</E>
</E>
</Entities>

======================================================================================================================================================
Any way that i could possibly do this?
 
K

Kevin Changet

I've not had any experience doing this. However I would think this would be
possible in one of two ways:

1) An XSLT transformation. Basically the output from InfoPath would get
picked up by some type of job that would use an XSLT file to change the
format from the Inofpath format to the new format. I've not personally done
this, but do know that this is possible.

2) Setting up Infopath to use this format. When you create a form it asks
if you want to base it on an XML file or schema. It's just a matter of
pointing it to this file you provided and then creating the form based on
these fields. A couple of things to consider. Since the form is based on a
schema, it will lock down the fields in the form (you won't be able to change
the names or add additional attributes to a field). You will be able to
change the field and attribute values, but not the actual field and attribute
names. There are ways around all of this, but are a bit more difficult to
do, you need to have a good understanding of XML to change this. i'd suggest
starting small, playing with it to better understand the difficulties you may
have using this approach. The great thing about this approach is that if
your output file format is 100% fixed, meaning you won't need to make format
changes to it, then this should be a good approach. After opening the file
in InfoPath, it's just a matter of dragging the fields onto the form and
viola! a form that will easily create this file.

-Using the XML you provided, I changed 1 thing. I closed the first <E>
entry </E> and didn't embed E entries inside other E entries. (You can do
this, but I'm not sure how well InfoPath will deal with this... it is very
picky about the XML being in a valid format).
-Created an IP form based on that, dragged the fields to the form and filled
out the form (adding 4 A Items to the form).
-If you don't want the MSInfoPath Added lines, you'll have to process the
file after output (like I explain above in 1).


The output is below:
<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolution solutionVersion="1.0.0.1" productVersion="11.0.6565"
PIVersion="1.0.0.0"
href="file:///D:\Documents%20and%20Settings\kchanget\My%20Documents\Template4.xsn" name="urn:schemas-microsoft-com:eek:ffice:infopath:Template4:" ?>
<?mso-application progid="InfoPath.Document"?>
<Entities
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-09-24T15:54:40" xml:lang="en-us">
<E Profiles="ABCZYX" Members="1000,1015," Title="Sage MMS Data"
Description="Group" Email="(e-mail address removed)"></E>
<E Profiles="1016," Members="1000," Title="Accounts" Description="Accounts
Entity" Email="(e-mail address removed)">
<I Title="Accounts Document" Description="Accounts Documentation"
Entity="!Accounts">
<T Entity="!Accounts" Title="Purchase Invoice" InformationType="Accounts
Document" Description="Purchase Invoice">
<A Entity="!Accounts" Template="Purchase Invoice" Title="Account Number"
InformationType="Accounts Document" Description="Account Number"
AttributeType="String">This is item 1</A>
<A Entity="!Accounts" Template="Purchase Invoice" Title="Account Number"
InformationType="Accounts Document" Description="Account Number"
AttributeType="String">This is item 2</A>
<A Entity="!Accounts" Template="Purchase Invoice" Title="Account Number"
InformationType="Accounts Document" Description="Account Number"
AttributeType="String">This is item 3</A>
<A Entity="!Accounts" Template="Purchase Invoice" Title="Account Number"
InformationType="Accounts Document" Description="Account Number"
AttributeType="String">This is Item 4</A>
<A Entity="!Accounts" Template="Purchase Invoice" Title="Sage Company
Name" InformationType="Accounts Document" Description="Sage Company Name"
AttributeType="String"></A>
</T>
</I>
</E>
</Entities>

There may be other possible ways that this can happen that I'm not aware of,
like I said, I've not really had to do this.
Hope this helps.

Kevin
 
W

wills.jason

Thanks for all the information Kevin, you are very helping - and
patient in pointing me in the right direction.

i shall have a look at the XSLT transformation first i think.

thank you once again.

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