0

How would I import the following XML into a SQL table, the child elements stating with IP tpl will vary for the amount per xml record. I think the main issue is handling the variable amount child elements if that is the correct term?

Thanks

<?xml version="1.0" encoding="utf-8"?>
<PportTimetable xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" timetableID="20161018020822" xmlns="http://www.thalesgroup.com/rtti/XmlTimetable/v8">
<Journey rid="201610188012733" uid="P12733" trainId="2J27" ssd="2016-10-18" toc="AW">
<OR tpl="MCHYNLT" act="TB" ptd="21:43" wtd="21:43" />
<IP tpl="DOVYJN" act="T " pta="21:49" ptd="21:49" wta="21:48:30" wtd="21:49:30" />
<IP tpl="PENHELG" act="R " plat="1" pta="21:58" ptd="21:58" wta="21:58:30" wtd="21:59" />
<IP tpl="ABDVY" act="T " plat="1" pta="22:01" ptd="22:02" wta="22:01:30" wtd="22:02" />
<IP tpl="TYWYN" act="T X " plat="2" pta="22:11" ptd="22:15" wta="22:11" wtd="22:15" />
<IP tpl="TONFNAU" act="R " plat="1" pta="22:18" ptd="22:18" wta="22:19" wtd="22:19:30" />
<IP tpl="LYNGRIL" act="R " plat="1" pta="22:25" ptd="22:25" wta="22:25:30" wtd="22:26" />
<IP tpl="FRBN" act="T " plat="1" pta="22:32" ptd="22:33" wta="22:33" wtd="22:33:30" />
<IP tpl="MFAM" act="R " plat="1" pta="22:35" ptd="22:35" wta="22:35:30" wtd="22:36" />
<IP tpl="BRMOUTH" act="T X " pta="22:44" ptd="22:46" wta="22:45" wtd="22:46:30" />
<IP tpl="LNAB" act="R " plat="1" pta="22:49" ptd="22:50" wta="22:50" wtd="22:51" />
<IP tpl="TALB" act="R " plat="1" pta="22:53" ptd="22:53" wta="22:55" wtd="22:55:30" />
<IP tpl="DYFRYNA" act="R " plat="1" pta="22:56" ptd="22:56" wta="22:58" wtd="22:58:30" />
<IP tpl="LBDR" act="R " plat="1" pta="23:00" ptd="23:00" wta="23:02" wtd="23:02:30" />
<IP tpl="PSRN" act="R " plat="1" pta="23:03" ptd="23:03" wta="23:04:30" wtd="23:05" />
<IP tpl="LNDW" act="R " plat="1" pta="23:05" ptd="23:05" wta="23:06:30" wtd="23:07" />
<IP tpl="HRLC" act="T " plat="2" pta="23:10" ptd="23:13" wta="23:12" wtd="23:13" />
<IP tpl="TYGWYN" act="R " plat="1" pta="23:16" ptd="23:16" wta="23:17" wtd="23:17:30" />
<IP tpl="TLSRNAU" act="R " plat="1" pta="23:19" ptd="23:19" wta="23:19:30" wtd="23:20" />
<IP tpl="LNDC" act="R " plat="1" pta="23:22" ptd="23:22" wta="23:22:30" wtd="23:23" />
<IP tpl="PRHN" act="T " plat="1" pta="23:25" ptd="23:26" wta="23:25:30" wtd="23:26" />
<IP tpl="MINFORD" act="T " plat="1" pta="23:29" ptd="23:29" wta="23:29" wtd="23:29:30" />
<IP tpl="PRTHMDG" act="T " pta="23:37" ptd="23:37" wta="23:36:30" wtd="23:37:30" />
<IP tpl="CRICCTH" act="T " plat="1" pta="23:45" ptd="23:45" wta="23:44:30" wtd="23:45" />
<IP tpl="PENYCHN" act="R " plat="1" pta="23:50" ptd="23:50" wta="23:50:30" wtd="23:51:30" />
<IP tpl="ABRE" act="R " plat="1" pta="23:53" ptd="23:53" wta="23:54:30" wtd="23:55" />
<DT tpl="PWLHELI" act="TF" plat="1" pta="23:59" wta="23:59" />
</Journey>
<Journey rid="201610186765436" uid="C65436" trainId="2S07" ssd="2016-10-18" toc="EM">
<OR tpl="NTNG" act="TB" plat="4" ptd="07:35" wtd="07:35" />
<PP tpl="NTHRFLJ" wtp="07:40" />
<IP tpl="BINGHAM" act="T " plat="2" pta="07:49" ptd="07:49" wta="07:48:30" wtd="07:49" />
<IP tpl="ASLCKTN" act="T " plat="1" pta="07:53" ptd="07:53" wta="07:52:30" wtd="07:53" />
<PP tpl="BOTESWJ" wtp="07:57" />
<IP tpl="BOTESFD" act="T " plat="2" pta="07:59" ptd="07:59" wta="07:59" wtd="07:59:30" />
<PP tpl="ALNGJN" wtp="08:06:30" />
<PP tpl="GTHMNBJ" wtp="08:10" />
<IP tpl="GTHM" act="T RM" plat="4" pta="08:12" ptd="08:16" wta="08:12" wtd="08:16" />
<PP tpl="GTHMNBJ" wtp="08:18" />
<PP tpl="ALNGEJN" wtp="08:22" />
<PP tpl="ALNGNJN" wtp="08:22:30" />
<IP tpl="ANCASTR" act="T " plat="2" pta="08:34" ptd="08:34" wta="08:34" wtd="08:34:30" />
<IP tpl="RAUCEBY" act="T " plat="2" pta="08:40" ptd="08:40" wta="08:40" wtd="08:42" />
<IP tpl="SLEFD" act="T " plat="1" pta="08:44" ptd="08:45" wta="08:46" wtd="08:47:30" />
<IP tpl="HCKNGTN" act="T " plat="2" pta="08:52" ptd="08:52" wta="08:54" wtd="08:54:30" />
<PP tpl="HBRTBDG" wtp="09:03:30" />
<IP tpl="BOSTON" act="T " plat="2" pta="09:11" ptd="09:12" wta="09:11" wtd="09:12" />
<PP tpl="SIBSEY" wtp="09:19:30" />
<PP tpl="BELWTRJ" wtp="09:26" />
<IP tpl="WAINFLT" act="T " plat="2" pta="09:36" ptd="09:36" wta="09:35:30" wtd="09:36:30" />
<DT tpl="SKEGNES" act="TF" pta="09:49" wta="09:48" />
</Journey>

Have you thoroughly searched for an answer before asking your question? Sharing your research helps everyone. Tell us what you found (on this site or elsewhere) and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and above all, it helps you get a more specific and relevant answer!

user3129787
  • 99
  • 1
  • 10

1 Answers1

0

You can use SQL Loader to import XML data into tables in SQL. There is a option as SQL loader which is a batch, on clicking imports the data to tables. The this you need to do is, have a log file, control file and batch file and have a code in the control file, how it should be loaded. If you could provide the sample XML data and table structure, will be helpful to provide you an exact solution

Look into this for reference - Can Oracle SQL*Loader process XML?

halfer
  • 19,824
  • 17
  • 99
  • 186
Jim Macaulay
  • 4,709
  • 4
  • 28
  • 53