views:

230

answers:

4

I need to convert an oracle table into xml and then return it to table form.

I converted a table using xmlgen, but I don't know how to reverse the conversion. I'm looking for an example of converting an xml file into a table.

+2  A: 

Here and here are working examples...

Shadi Almosri
A: 

You can use XSLT to produce a CSV formated text.

ftl
A: 

Maybe Hyperjaxb is what you need?

It can build databse schemas from XML and vice versa and generate Object Bindings to convert between DB and XML and vice versa:

https://hyperjaxb.dev.java.net/

https://www.hibernate.org/218.html

Henning
A: 

Depending on what you're ultimately trying to do, a simple way is to use XMLSequence() and Table() functions in SQL to convert a nodeset from an Xpath into a rowsource:

SELECT
    t.extract( '/bar/@id' ).getNumberVal() ID
FROM
    TABLE( XMLSEQUENCE( 
        XMLTYPE( 
            '<foo><bar id="1" /><bar id="2" /></foo>' 
        ).extract( '//bar' ) 
    ) ) t
kurosch