Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML 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 November 19th, 2007, 01:54 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default getting data from XML and insert it into a databas

Hi all, I have a customer list xml file that contains the folowing data:

<?xml version="1.0" ?>
<CustomerList>
 <Identification>
    <ID>1</ID>
    <Name>John </Name>
 </Identification>
<Order>
   <OrderNr>2</OrderNr>
   <customerNr>100</customerNr>
   <customerName>XXXX YYYYY</CustomerName>
</Order>
<Location>
  <ID>1</Location>
  <Place>NY</Place>
</Location>
<Identification>
    <ID>2</ID>
    <Name>David</Name>
 </Identification>
<Order>
   <OrderNr>3</OrderNr>
   <customernrNr>200</customerNr>
   <customerName>zzzzz vvvv</CustomerName>
</Order>
<Location>
  <ID>2</Location>
  <Place>NY</Place>
</Location>
<Identification>
    <ID>1</ID>
    <Name>John </Name>
</Identification>
<Order>
   <OrderNr>6</OrderNr>
   <customernrNr>300</customerNr>
   <customerName>KKKK LLLL</CustomerName>
</Order>
<Location>
  <ID>3</Location>
  <Place>AR</Place>
</Location>
</CustomerList>

I want to collect the ID value from Identification Node and OrderNr from Order Node and Insert them in a table (xmlTestTable) having ID and OrderNr as fields.

NB: ID from Identification and ID from Location are the same.
Can experts help me how to do it. Any sample code is apreciated. Thank you in advance



 
Old November 19th, 2007, 02:29 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You haven't said what technology you are using.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 19th, 2007, 02:34 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi

Thank you for your reply
I am using asp.net, C#

belete

 
Old November 20th, 2007, 12:38 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to load the XML into a class that can read it (XmlDocument, XmlTextReader) and then you can query or read, respectively the XML to get the data you want.

-Peter




Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk insertion from a data table to oracle databas Alexkure ASP.NET 1.0 and 1.1 Professional 0 November 12th, 2008 03:24 AM
About Insert Multiple Rows of GridView to Databas divekar.vishal ASP.NET 2.0 Professional 0 April 30th, 2008 12:28 AM
append/insert data to xml file andhiez XML 5 April 18th, 2008 11:13 AM
How to insert bulk of data through form in databas ashuphp Beginning PHP 1 April 11th, 2007 07:36 AM
insert data param into xml from external file alexshiell XSLT 0 January 24th, 2006 01:47 PM





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