Importing xml file into a table

sven2

Registered User.
Local time
Today, 19:47
Joined
Apr 28, 2007
Messages
297
Hello,

is it possible to import an xml file into a table?

Below an example of the xml file:

- <SMDATA>
- <EMPLOYEE PCODE="27AB003">
<IDENTITY LastName="test" Firstname="testname" Language="N" Birth="22/08/1961" Sex="M" Employ="01/01/1997" Out="" Level="A" Category="A" Communic1="" Communic2="" />
<ADDRESS Address="Huidstraat 2" Zip="9250" City="Testing" Commpr1="075/31.45.21" Commpr2="" E-mail="" />
<FUNCTION Chef="" FunctionCode="MECHCA" Ptitle="Mechanieker CA" Begeleider="" Funcname2="" Fcode2="" Funcname3="" Fcode3="" Shift="DWA" ShiftName="" />
- <ORGANISATION>
<CONTRACT Timeperc="100" Statuut="GW" />
<ADMIN Costcenter="624PA" Dcode="TD" Parent="OP" Deprtmnt="OP - Technische Diensten" ParentName="Test" Niv3="342" MachineGroep="OP - ONDERHOUD CENTR. ATELIER" />
<SALARYCLASSIF Salarycode="5" Salary="0" />
</ORGANISATION>
</EMPLOYEE>

Can somebody give me an example how to import this file or give some directions how to do it.

Best regards,
Sven.
-
<
 
very very tricky/fiddly looking at the above

you will not find it easy getting the attributes from within the tag pairs

eg

lastname="test"
firstname="testname"

A lot of xml viewers won't even SHOW you the fact that these attributes exist.

--------------
msxml is possibly the best solution, look at ms DOM help library, but its hard going.


out of interest - there should be a closing tag for the opening <SMDATA> tag? - are there lots of employees in this file?


------------
technically, I actually EXTRACT data from inbound xml files by manually examining the data first so that I know exactly what I want to extract from the file - then using msxml to recursively walk the node tree, and extract the data from the nodes as I reach the data I want - and write it to tables with "SQL insert statements". As I say, getting the data out of attributes isnt starightforward at all.

I tried to CREATE xml files in a similar (recursive) way, but have now given up, and I just create them by explicitly manipulating the tags to write the file.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom