473,767 Members | 8,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load XML with nested tables into SQL Server

Hi all

I have problems loading XML data into SQL Server.
What is the best way to go ? I am new in using XML documents.
I have tried to do it with "Integratio n Services" and
also with "XmlTextReader" , "XPathDocument" , "DataSet.ReadXM L" ...

None of this is working well because my XML document
has nested tables and in XML documents I dont see any
relations ...

Thanks for any comment .

Best regards
Frank

Here is what the XML looks like:

<?xml version="1.0" encoding="iso-8859-1" ?>
- <Test>
- <Transactions >
- <Trx>
<TrxCol1>fals e</TrxCol1>
<TrxCol2>SWAP </TrxCol2>
- <calendars>
<calendar>CHF </calendar>
</calendars>
- <legs>
- <leg>
<LegCol1>true </LegCol1>
- <calendars>
<calendar>JPY </calendar>
<calendar>GBP </calendar>
</calendars>
<LegCol2>fals e</LegCol2>
- <fixings>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-19</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-20</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-21</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-22</FixingCol2>
</fixing>
</fixings>
</leg>
</legs>
<nr>XY88.6</nr>
</Trx>
- <Trx>
<TrxCol1>true </TrxCol1>
<TrxCol2>BOND </TrxCol2>
- <calendars>
<calendar>EUR </calendar>
</calendars>
- <legs>
- <leg>
<LegCol1>true </LegCol1>
- <calendars>
<calendar>USD </calendar>
<calendar>GBP </calendar>
</calendars>
<LegCol2>fals e</LegCol2>
- <fixings>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-19</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-20</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-21</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-22</FixingCol2>
</fixing>
</fixings>
</leg>
</legs>
<nr>XY88.6</nr>
</Trx>
</Transactions>
</Test>
Jun 27 '08 #1
1 1722
It will be easier to understand your problem if you describe the tables. I
think problem is becuase the way calendars is related to Transactions and
legs. I think if you remove calendars from the xml file then you can use
dataset.ReadXML Schema and dataset.ReadXML to load the data.
You might have to create an empty dataset by querying your tables first and
then try to use dataset.ReadXML to load the data.

"Frank Uray" <Fr*******@disc ussions.microso ft.comwrote in message
news:A2******** *************** ***********@mic rosoft.com...
Hi all

I have problems loading XML data into SQL Server.
What is the best way to go ? I am new in using XML documents.
I have tried to do it with "Integratio n Services" and
also with "XmlTextReader" , "XPathDocument" , "DataSet.ReadXM L" ...

None of this is working well because my XML document
has nested tables and in XML documents I dont see any
relations ...

Thanks for any comment .

Best regards
Frank

Here is what the XML looks like:

<?xml version="1.0" encoding="iso-8859-1" ?>
- <Test>
- <Transactions >
- <Trx>
<TrxCol1>fals e</TrxCol1>
<TrxCol2>SWAP </TrxCol2>
- <calendars>
<calendar>CHF </calendar>
</calendars>
- <legs>
- <leg>
<LegCol1>true </LegCol1>
- <calendars>
<calendar>JPY </calendar>
<calendar>GBP </calendar>
</calendars>
<LegCol2>fals e</LegCol2>
- <fixings>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-19</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-20</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-21</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-03-22</FixingCol2>
</fixing>
</fixings>
</leg>
</legs>
<nr>XY88.6</nr>
</Trx>
- <Trx>
<TrxCol1>true </TrxCol1>
<TrxCol2>BOND </TrxCol2>
- <calendars>
<calendar>EUR </calendar>
</calendars>
- <legs>
- <leg>
<LegCol1>true </LegCol1>
- <calendars>
<calendar>USD </calendar>
<calendar>GBP </calendar>
</calendars>
<LegCol2>fals e</LegCol2>
- <fixings>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-19</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-20</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-21</FixingCol2>
</fixing>
- <fixing>
<FixingCol1>0 </FixingCol1>
<FixingCol2>200 7-04-22</FixingCol2>
</fixing>
</fixings>
</leg>
</legs>
<nr>XY88.6</nr>
</Trx>
</Transactions>
</Test>


Jun 27 '08 #2

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

Similar topics

5
3307
by: Ben Long | last post by:
Hi All, A partner of mine has been charged with identifying a performance / load problem currently experienced on one of our websites. I'm thinking it may be a combination of HTML formatting and syntax along with the number of images (<img> tags) being used on a single page. The problems seem to persist around IE (5.0+ on multiple win OS), however FF 1.0 sometimes chokes but usually clears once the images are loaded.
1
3077
by: Hazz | last post by:
I have 5 tables in SQL Server. Each with the following design and a sample chain of the relationships from the root (WRL - World) UUS is the 'Code' of the first table and it is the 'Parent' value of the second table, etc. Parent varchar 3 Name varchar 60 Code varchar 3 WRL United States UUS <- UUS California UCA <- UCA North Coast UNC <- UNC
0
5320
by: phillip | last post by:
This is interesting, I have attached my web.config file and the exception I have been logging. I created a library which provide data access to a database and a control system. The library is written in C#. I created a small .exe file to test that the library builds propertly from configuration and that it communicates properly. This work great in the System.Windows.Forms. However, when I use the library in a web enviroment things...
3
4041
by: Eirik Eldorsen | last post by:
Im trying to make a nested repeater with 3 levels. I've successfully created a nested repeater with 2 levels, but when adding the 3rd level I get an InvalidCastException. What am I doing wrong? Here is my code: <asp:Repeater id="level1Repeater" runat="server"> <itemtemplate>
1
2078
by: Thu | last post by:
Hi, I create a Dataset to link three tables in my Access database. E.g. The three tables are , , . I then create 2 DataRelations, 1st relation (Order_Cust_Rel) links and using CustomerID field that exists in both tables and 2nd relation (Order_Product_Rel) links and using ProductID field. I set the nested property of the relations to True so that the output will be nested. I then use WriteXML to output the dataset to a StreamWriter.
0
4666
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box and also get the datakey (in my case personid) of the the rows selected. Please point me in the right direction. This is what i have so far but i have problem accessing the child gridview in the button click event Cheers, Shilpa. <asp:GridView...
2
1920
by: Me LK | last post by:
I have a set of drop downs nested in a datagrid. Each drop down is a size or color for an item. Each row of the grid has a button which leads to a cart. When a user selects something from the first row or nested drop downs the page refreshes, the correct item is selected in the list and the and upon clicking the add to cart button the correct choices show up in the database. When a person selects something from a row other then the first...
39
2587
by: Gilles Ganault | last post by:
Hello, I'm no LAMP expert, and a friend of mine is running a site which is a bit overloaded. Before upgrading, he'd like to make sure there's no easy way to improve efficiency. A couple of things: - MySQL : as much as possible, he keeps query results in RAM, but apparently, each is session-specific, which means that results can't be shared with other users.
0
1185
petepell
by: petepell | last post by:
Hello all, I am developing an application in VB 2008 that works with a SQL2005 DB to store and manipulate employee data. In one section of the app I want to be able to show a treeview of the hierarchy as a whole showing a nested hierarchy of who reports to who such that when it is first loaded, all you will see is the top guy in the company with a plus next to his name. Opening that will reveal his first level reports and opening those will...
0
9575
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10014
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.