473,748 Members | 6,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Parent ID into tabel from XML into SQL

1 New Member
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="norma l" confirmation="n o">
<resources>
<resource>
<id>CWws0086</id>
<code>86</code>
<name>Jansen</name>
<resource_kin d>
<code>MWK</code>
<name>Motorwage n 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,reso urce_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:sche mas-microsoft-com:xml-data"
xmlns:dt="urn:s chemas-microsoft-com:xml:datatyp es"
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="M sg_resource">
<element type="id" sql:field="Id" />
<element type="code" sql:field="code " />
<element type="name" sql:field="Name " />
<element type="active" sql:field="acti ve" />
</ElementType>

</Schema>
[/HTML]
Thxs
Jul 19 '07 #1
1 1794
Dököll
2,364 Recognized Expert Top Contributor
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
7957
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' => 'aaa') , array( 'id' => 'B', 'parent_id' => 'A', 'value' => 'bbb') , array( 'id' => 'C', 'parent_id' => 'B', 'value' => 'ccc') , array( 'id' => 'D', 'parent_id' => 'A', 'value' => 'ddd')
2
1524
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
2632
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
5949
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
1507
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
1987
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 dus niet afgebeeld. De tabel in de kolom heeft als Data Type char, de Length staat op 10 en Allow Nulls staat aangevinkt. Wie kan mij helpen? Dank.
2
1228
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 tabel called customer_nfo with one variable for ID not null unsigned auto increment, then another with first_name not null. ill post the code that heidisql posts CREATE TABLE customer_info (ID MEDIUMINT (10) UNSIGNED DEFAULT '0' NOT NULL...
7
1853
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 = tabel_1 case (something2) tabel = tabel_2 etc....
1
4250
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 assign them to products. For the product ID, I have an auto increment value for the primary key to avoid duplicate item numbers. Since I do not want to pass all of my record values to my image upload program (when I write it), I assume to just submit...
0
8991
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
9541
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...
1
9321
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,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.