I have the following XML file (Called CustomerList.xml) ...
<?xml version="1.0" encoding="utf-8"?>
<customerList xmlns="http://tempuri.org/CustomerListSchema.xsd">
<customer>
<CompanyName>Company One</CompanyName>
<ContactName>Joe</ContactName>
<Email>Jo*@CompanyOne.com</Email>
<Phone>01234 567890</Phone>
<BillToAddress>
<Name>Company One</Name>
<Street>1 Some Street</Street>
<City>Some City</City>
<State>Some State</State>
<Zip>12345</Zip>
</BillToAddress>
<ShipToAddress>
<Name>Company One</Name>
<Street>1 Some Street</Street>
<City>Some City</City>
<State>Some State</State>
<Zip>12345</Zip>
</ShipToAddress>
</customer>
<customer>
<CompanyName>Company Two</CompanyName>
<ContactName>Fred</ContactName>
<Email>fr**@companytwo.com</Email>
<Phone>09876 543210</Phone>
<BillToAddress>
<Name>Company Two</Name>
<Street>1 This Street</Street>
<City>This City</City>
<State>This State</State>
<Zip>67890</Zip>
</BillToAddress>
<ShipToAddress>
<Name>Company Two</Name>
<Street>1 This Street</Street>
<City>This City</City>
<State>This State</State>
<Zip>67890</Zip>
</ShipToAddress>
</customer>
</customerList>
With the following Scema file (Called CustomerListSchema.xsd)...
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="CustomerListSchema"
targetNamespace="http://tempuri.org/CustomerListSchema.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/CustomerListSchema.xsd"
xmlns:mstns="http://tempuri.org/CustomerListSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="postalCode">
<xs:restriction base="xs:positiveInteger">
<xs:pattern value="\d{5}" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="usAddress">
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Street" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element name="State" type="xs:string" />
<xs:element name="Zip" type="postalCode" />
</xs:sequence>
</xs:complexType>
<xs:element name="customerList">
<xs:complexType>
<xs:sequence>
<xs:element name="customer">
<xs:complexType>
<xs:sequence>
<xs:element name="CompanyName" type="xs:string" />
<xs:element name="ContactName" type="xs:string" />
<xs:element name="Email" type="xs:string" />
<xs:element name="Phone" type="xs:string" />
<xs:element name="BillToAddress" type="usAddress" />
<xs:element name="ShipToAddress" type="usAddress" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
In a VB.Net Windows App project I can easily get some of the data into
DataGridViews (one called oDGV1 and the called oDGV2) using the
following code in the form_Load...
Dim oDSet As New DataSet
oDSet.ReadXml("customerList.xml")
oDgv.DataSource = oDSet
oDgv.DataMember = "customer"
oDGV2.DataSource = oDSet
oDGV2.DataMember = "ShipToAddress"
However this only gives me bits of the data and I would like to know
how to "join" the data?
IE. In oDGV1 I get the following...
Company One Joe Jo*@CompanyOne.com 01234 567890
Company Two Fred fr**@companytwo.com 09876 543210
and in oDGV2 I get...
Company One House 1 Some Street Some City Some State 12345
Company Two House 1 This Street This City This State 67890
How do I get the following into a DataGridView?
Company One Joe Company One House 1 Some Street Some City Some State
12345
Company Two Fred Company Two House 1 This Street This City This State
67890