Reading XML file with nodes containing 'level=' into a DataSet object.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have an XML file that I will be reading into a DataSet object for import to SQL Server. I am noticing that some of the nodes contain an attribute level=. I am wondering how this will be handled within my program when I try to load the DataSet object.
I suppose it may create multiple fields or perhaps concatenate the data into the same field which would actually be more desirable for this project. Im looking for some insight on what exactly to do with this level= for the node <Department>. How
would be the best way to import to SQL Server with DataSet in this regard?

<pre class="prettyprint <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Personnel>
<Person name="Vincent McMahon
<Personal>
<Gender>M</Gender>
<DOB>1945-10-04</DOB>
<Address></Address>
<City></City>
<State></State>
<Zip5>06902</Zip5>
<Phone></Phone>
</Personal>
<Internal>
<ID>321679814</ID>
<StartDate>1971-01-01</StartDate>
<Active>Y</Active>
<Department level="1 Engineering</Department>
<Department level="2 Quality Assurance</Department>
<Title>Quality Assurance Manager</Title>
<Manager>Selig</Manager>
</Internal>
</Person>
<Person name="Patricia Stratigias
<Personal>
<Gender>F</Gender>
<DOB>DOB>
<Address></Address>
<City></City>
<State>ON</State>
<ZipC></ZipC>
</Personal>
<Internal>
<ID>654981354</ID>
<StartDate>2000-04-14</StartDate>
<Active>Y</Active>
<Department level="1 Engineering</Department>
<Department level="2 Quality Assurance</Department>
<Title>Senior Quality Assurance Engineer</Title>
<Manager>Francona</Manager>
</Internal>
</Person>
<Person name="Ted DiBeasi
<Personal>
<Gender>M</Gender>
<DOB></DOB>
<Address></Address>
<City></City>
<State>MS</State>
<Zip5></Zip5>
<Zip4></Zip4>
<Phone></Phone>
</Personal>
<Internal>
<ID>981433305</ID>
<StartDate>1975-06-01</StartDate>
<Active>N</Active>
<EndDate>2002-08-22</EndDate>
<Department level="1 Engineering</Department>
<Department level="2 Quality Assurance</Department>
<Title>Quality Assurance Engineer</Title>
<Manager>Francona</Manager>
</Internal>
</Person>
</Personnel>[/code]
<br/>
Thank You!<br/>
<br/>

View the full article
 
Back
Top