简体   繁体   中英

convert xml into table

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.

这里这里是工作示例...

You can create a relational view over xml table using XMLTABLE syntax.

eg SELECT warehouse_name warehouse, warehouse2."Water", warehouse2."Rail" FROM warehouses, XMLTABLE('/Warehouse' PASSING warehouses.warehouse_spec COLUMNS "Water" varchar2(6) PATH '/Warehouse/WaterAccess', "Rail" varchar2(6) PATH '/Warehouse/RailAccess') warehouse2;

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions228.htm

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

您可以使用XSLT生成CSV格式的文本。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM