Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2010, 08:03 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default Parsing XML data into SQL Server

Hi,


I need to take an xml file, parse the data and invport it onto SQL server.

I'm not an expert on xml and normally I have no problems with this, but the xml file I have been presented with is in the format below and has a schema defined.


Code:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
 xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
 xmlns:rs='urn:schemas-microsoft-com:rowset'
 xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
 <s:ElementType name='row' content='eltOnly' rs:updatable='true'>
  <s:AttributeType name='Select' rs:number='1' rs:write='true'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='5'
    rs:precision='0' rs:fixedlength='true' rs:maybenull='false'/>
  </s:AttributeType>
  <s:AttributeType name='UI' rs:number='2' rs:write='true'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='1'
    rs:precision='0' rs:fixedlength='true' rs:maybenull='false'/>
  </s:AttributeType>
  <s:AttributeType name='No' rs:number='3' rs:write='true'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10'
    rs:precision='0' rs:fixedlength='true' rs:maybenull='false'/>
  </s:AttributeType>
  <s:AttributeType name='ProductID' rs:number='4' rs:write='true'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10'
    rs:precision='0' rs:fixedlength='true' rs:maybenull='false'/>
  </s:AttributeType>
  <s:AttributeType name='Distribution' rs:number='5' rs:write='true'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'
    rs:precision='0' rs:fixedlength='true' rs:maybenull='false'/>
  </s:AttributeType>
   <s:extends type='rs:rowbase'/>
 </s:ElementType>
</s:Schema>
<rs:data>
 <rs:insert>
  <z:row UI=' ' No='100 D     ' ProductID='123456    '
    Distribution='Web                                               '/>
  <z:row UI=' ' No='501 D     ' ProductID='123457    '
    Distribution='Web                                               '/>
  <z:row UI=' ' No='1500 D    ' ProductID='123458    '
    Distribution='Tel                                               '/>
  <z:row UI=' ' No='1900 D    ' ProductID='123459    '
    Distribution='Tel                                               '/>
 </rs:insert>
</rs:data>
</xml>

I have cut down the data for your convenience (there are a lot more fields in eah row and a lot more lines)

What I need to know is how do I found out what is in each row for the fields 'No', 'ProductID' and 'Distribution' when I read in the data.
I can push the data into sql once I know the what it is, I just can' t work out how to read the fields themselves.

Thanks in advance.
__________________
Try our latest project www.nobanx.com Currency Exchange for members





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing XML Data from a remote site timeware XML 1 June 1st, 2006 08:25 AM
retrieve data from SQL server wih XML Thebravehearth XML 3 October 7th, 2004 02:07 AM
XML from SQL Server data spinout XML 5 September 25th, 2004 05:18 AM
inser xml data to sql server from asp ak Classic ASP Databases 7 February 25th, 2004 01:05 PM
inserting some data from xml file to sql server ak Classic ASP XML 1 February 25th, 2004 10:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.