473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to read from different'levels' of xml to a datagridview?

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
Jun 27 '08 #1
0 1484

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: teddyparnell | last post by:
I'm Creating a database in access which needs different levels of users. The highest being allowed to see and access everything, including code, like admin. The next being allowed to see and use...
9
by: helpful sql | last post by:
Hi all, I have a DataGridView control in my Windows Forms application. I am binding it to a DataTable in another assembly. The name of the assembly is ActivityListDALC. I want to bind my grid to...
0
by: sphinney | last post by:
I have a complex Access 2002 database with multimple tables, queries, forms, and reports. The database is used by miltiple users that have one of four different levels of security. The databae uses...
1
by: sree078 | last post by:
hi I've a table with coln names ID Name ParentID Level
1
by: enrico via DotNetMonster.com | last post by:
can you input a field in a datagridview that can be save to your database? can you make a calculation on it? please tell me how. -- Message posted via DotNetMonster.com...
23
by: Dan Tallent | last post by:
A textbox has a attribute for ReadOnly. This seems like such a simple concept. When a textbox is set to read only the user cannot change the contents of the field. I have been trying to find...
5
by: LynneSochinski | last post by:
Hi, I'm self taught and am trying to create a database in Access 2003 for our small Real Estate firm that allows us to track our Agents and their transactions. Additionally, we've set up a system...
0
by: Steve Kelley | last post by:
Table is structured as: Key_1 Key_2 Cost_1 Cost_2 Total_Cost I want to sum the totals at the following levels: 1) the entire recordset 2) for Key_1
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.