• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

parsing repeating subdocuments

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a common problem for importing data; I'm surprised I
haven't yet found an example of it, so I'm wondering if anyone
here has solved this problem before.
I'm using Oracle's DOM parser and XML-XSL utility, XSU. The incoming XML document is a set of records that need to be
imported into a database. The problem is each record needs a processing step before it's ready to be imported. Each record needs to be split into a part that contains some of the needed data, and a part that contains data to do a lookup to get a key. The result of the lookup is a foreign key that gets combined with the needed data to form a valid XML document that can be imported.
I've worked out the XSL to do transformations that do the lookup, but I haven't yet found a good solution for looping over the incoming XML and grabbing each record at a time. I'm poring over the book 'Building Oracle XML Applications' by Muench, but haven't found a solution yet.
Anybody have any ideas? TIA if you do....
--Rick
------------------
Rick Casey http://rtt.colorado.edu/~caseyh
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<xsl:for-each> with a pattern match?? Is that what you're looking for?
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java2 Platform.
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rick,
If you can read your incoming XML, you should be able to parse it?
Can you give some more info, i.e. a sample of the incoming XML and what you want to do with it?
Marius
 
rick casey
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Can you give some more info, i.e. a sample of the incoming XML
>and what you want to do with it?
>Marius
Ok. Here's some sample XML:
<!DOCTYPE hydro SYSTEM "hydro.dtd">
<hydro>
<ROW num="1">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>16-APR-2000 03:00:00</DATE_HOUR>
<VALUE>100</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>~</VALIDATION>
</ROW>
<ROW num="2">
<HM_SITE_CODE>HDMLC</HM_SITE_CODE>
<HM_PCODE>TRACE</HM_PCODE>
<DATE_HOUR>16-APR-2000 04:00:00</DATE_HOUR>
<VALUE>200</VALUE>
<SOURCE_ID>4</SOURCE_ID>
<VALIDATION>~</VALIDATION>
</ROW>
...[many more records could be here]
</hydro>

I must use HM_SITE_CODE and HM_PCODE to do the lookup, the results of which I combine with the other 3 tags to make a valid input record. Since each lookup result is probably different, I need to loop over each nodeset that defines a record.
I'm investigating Ajith's suggestion in previous message of using xsl:foreach(); it might work, but if you can suggest something better, please do let me know.
Thanks!
--Rick
 
rick casey
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another piece of information: this _is_ being done in Java, not just purely XSL/XML.
There must be a processing loop in Java, since the lookup must return a result and combine it with other data - something XSL cannot do by itself...as far as I know!
--rick
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!