3.3. Looking Briefly at XML

One of the exciting things about InfoPath is that under the covers it all comes down to XML (Extensible Markup Language). As mentioned, XML has fast become the de facto standard for transferring and storing data on and off the Web, as well as between various business systems. XML itself is not a terribly confusing file structure, because it is just a bunch of tags.

To quickly examine XML, take a look at a small example called Customers.XML, shown here:

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Customers.xsd" generated="2004-07-30T12:11:47">
<tblCustomers>
<CustomerID>1</CustomerID>
<CustomerName>Diana Barker</CustomerName>
</tblCustomers>
<tblCustomers>
<CustomerID>2</CustomerID>
<CustomerName>Scott Barker</CustomerName>
</tblCustomers>
<tblCustomers>
<CustomerID>3</CustomerID>
<CustomerName>Chris Barker</CustomerName>
</tblCustomers>
<tblCustomers>
<CustomerID>4</CustomerID>
<CustomerName>Kari Anne Barker</CustomerName>
</tblCustomers>
<tblCustomers>
<CustomerID>5</CustomerID>
<CustomerName>Nichole Barker</CustomerName>
</tblCustomers>
<tblCustomers>
<CustomerID>6</CustomerID>
<CustomerName>David Barker</CustomerName>
</tblCustomers>
<tblCustomers>
<CustomerID>7</CustomerID>

<CustomerName>Joseph Barker</CustomerName>
</tblCustomers>
</dataroot>

You may have heard of a language used for Web page design called HTML (Hypertext Markup Language). HTML is a language that uses tags to specify how to create a presentation in a Web browser. XML uses tags to specify how to work with data.

You can see from the XML file just displayed that it refers to another file called Customers.xsd. .xsd files are called schema files and hold information about fields such as the type of data they are.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
<xsd:element name="dataroot">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="tblCustomers" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="generated" type="xsd:dateTime"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="tblCustomers">
<xsd:annotation>
<xsd:appinfo>
<od:index index-name="PrimaryKey" index-key="CustomerID " primary="yes" unique="yes" clustered="no"/>
<od:index index-name="CustomerID" index-key="CustomerID " primary="no" unique="no" clustered="no"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CustomerID" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int"/>
<xsd:element name="CustomerName" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

The good news is that you don't have to deal with the XML files directly to work with InfoPath. If you create a standalone InfoPath form that uses XML for storage, then InfoPath will build the schema for you.

3.3.1.

3.3.1.1. Try It Out: Examining an XML Document
  1. Download Customer.xml.

  2. In Windows Explorer, right-click on the file, and choose Edit. The file will be displayed in Notepad as shown in Figure 3-8.

    Figure 3.8. Figure 3-8
  3. Repeat the steps for Customers.xsd, which is the schema document.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.189.98