473,385 Members | 1,620 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,385 software developers and data experts.

Creating Parent ID into tabel from XML into SQL

1
Hi,

I want to import a XML file into SQL.
But i can't find a good example to create an unique id from an higer element.
I can create different tables, but a link between them not. I want to create an ID of the parent.
Can somebody help me with a correct mapping schema?

The xml file is :
[HTML]
<?xml version="1.0" encoding="ISO-8859-1" ?>
<Export>
<msg-out priority="normal" confirmation="no">
<resources>
<resource>
<id>CWws0086</id>
<code>86</code>
<name>Jansen</name>
<resource_kind>
<code>MWK</code>
<name>Motorwagen box</name>
<resource_tag>2</resource_tag>
</resource_kind>
<active>true</active>
<division>
<code>1</code>
<name>Transport</name>
</division>
</resource>
</resources>
</msg-out>
</Export>

[/HTML]
So i can create 2 tabels "Resource ( with fields id, code,name) and Resource_kind. (code,name,resource_tag) with 2 mapping scrips.
But no relation of them.
Can somebody help me with it and also to create everything in 1 script?

This is one script i already have :
[HTML]
<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >

<ElementType name="id" dt:type="string" />
<ElementType name="code" dt:type="string" />
<ElementType name="name" dt:type="string" />
<ElementType name="active" dt:type="string" />
<ElementType name="resource_tag" dt:type="string" />


<ElementType name="Export" sql:is-constant="1"></ElementType>
<ElementType name="msg-out" sql:is-constant="1"></ElementType>
<ElementType name="resources" sql:is-constant="1">
<element type="resource" />
</ElementType>

<ElementType name="resource" sql:relation="Msg_resource">
<element type="id" sql:field="Id" />
<element type="code" sql:field="code" />
<element type="name" sql:field="Name" />
<element type="active" sql:field="active" />
</ElementType>

</Schema>
[/HTML]
Thxs
Jul 19 '07 #1
1 1772
Dököll
2,364 Expert 2GB
Hiya Ronsol!

I just posted the below and thought you also might find the second helpful: http://www.w3schools.com/xquery/xquery_add.asp

http://www.w3schools.com/dom/dom_nodes_set.asp

In a bit and welcome...
Jul 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jeffrey Silverman | last post by:
Hi, all. I have a linked list. I need an algorithm to create a tree structure from that list. Basically, I want to turn this: $list = array( array( 'id' => 'A', 'parent_id' => null, 'value'...
2
by: Wilhelm Kutting | last post by:
Hi i like to replace my layout tabel with css-style. Her is what it looks like now: Name: Adress: Zip-Code <--------------> Problem
15
by: Geagleeye | last post by:
Hi. I need to interpolate som data i have in my tabel. my tabel looks like this. Y X 0 0 0,026 0,037 0,003 0,038 0,005 0,064
2
by: Geagleeye | last post by:
hi. im trying to interpolate som data i got in my tabel. Does any one got any code or example i could use.. hope somone want to help
9
by: elia | last post by:
Hello, I would like to show a line in a tabel in html if there is quantity of article choosed. My code is: <? if ($quantite1 0) { echo(' <tr>
3
by: Eus | last post by:
Ik wil uit een tabel het gehele getal halen, de waarde staat als 05612123 maar wanneer ik dit opvraag in bv. de Query Analyzer wordt de waarde gegeven als 5612123. De 0 welke ervoor staat wordt...
2
by: GGawaran | last post by:
Ive setup the MySQL server and am using heidi to create the tables, Ive had no trouble creating any new databases or certain tables. But my problem im running into right now, im trying to create a...
7
by: Kristiansj | last post by:
Hey, I am a fairly novice coder and I am having some trouble making an elegant solution to the following problem: (pseudocode) ------------ switch (something) { case (something1) tabel =...
1
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.