Saving InfoPath Forms to SQL Server 2005 as XML
page 3 of 7
by S.Y.M. Wong-A-Ton
Average Rating: 
Views (Total / Last 10 Days): 40144/ 73

Design the InfoPath form

Create a new InfoPath form that has a Date Picker control, a Text Box control, a Rich Text Box control, a File Attachment control, and a Picture control as shown in Figure 1.

Figure 1


To be able to save this form to SQL Server as typed XML, i.e. XML data that has been associated with an XML schema, you must know what the XML schema for the InfoPath form is before you can create the database table. Perform the following steps to extract the XML schema for the InfoPath form:

1.    On the File menu, click Extract Form Files.

2.    In the Browse for Folder dialog box, select a folder to save the extracted files in and click OK.

3.    Open Windows Explorer and navigate to the folder where you saved the extracted files.

4.    Open the myschema.xsd file to view and copy the XML schema for the InfoPath form (see Listing 1).

Listing 1: XML schema for the InfoPath form

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <xsd:element name="myFields">
        <xsd:element ref="my:field1" minOccurs="0"/>
        <xsd:element ref="my:field2" minOccurs="0"/>
        <xsd:element ref="my:field3" minOccurs="0"/>
        <xsd:element ref="my:field4" minOccurs="0"/>
        <xsd:element ref="my:field5" minOccurs="0"/>
      <xsd:anyAttribute processContents="lax" namespace=""/>
  <xsd:element name="field1" nillable="true" type="xsd:date"/>
  <xsd:element name="field2" type="xsd:string"/>
  <xsd:element name="field3">
    <xsd:complexType mixed="true">
        <xsd:any minOccurs="0" maxOccurs="unbounded"
 namespace="" processContents="lax"/>
  <xsd:element name="field4" nillable="true" type="xsd:base64Binary"/>
  <xsd:element name="field5" nillable="true" type="xsd:base64Binary"/>

View Entire Article

User Comments

No comments posted yet.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-07-25 12:34:06 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search