extract data from external XML file (excel format)
802454Oct 1 2010 — edited Dec 8 2010i have a XML file from SAP which is excel format...like this+
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:Integer="java://java.lang.Integer"
xmlns:SL="http://schemas.microsoft.com/schemaLibrary/2003/core"
xmlns:alv="http://www.sap.com/ALV/2.6"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:asx="http://www.sap.com/abapxml"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:xlink="http://www.w3.org/1999/xlink">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Version>12.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<DownloadComponents/>
<LocationOfComponents HRef="file:///\\msowc.cab"/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>12660</WindowHeight>
<WindowWidth>18060</WindowWidth>
<WindowTopX>240</WindowTopX>
<WindowTopY>60</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Arial"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62">
<Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
</Style>
<Style ss:ID="s63">
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Interior ss:Color="#00CCFF" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s64">
<Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
<NumberFormat ss:Format="Short Date"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="19" ss:ExpandedRowCount="9" x:FullColumns="1"
x:FullRows="1">
<Column ss:StyleID="s62" ss:AutoFitWidth="0" ss:Span="16"/>
<Column ss:Index="18" ss:StyleID="s62" ss:Width="53.25" ss:Span="1"/>
<Row>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdfasdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdfasdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">asdfssdfad</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">ssd</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">asdf</Data></Cell>
<Cell><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell><Data ss:Type="String">asdfs</Data></Cell>
<Cell><Data ss:Type="String">177</Data></Cell>
<Cell><Data ss:Type="String">sadf</Data></Cell>
<Cell><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell ss:Index="8"><Data ss:Type="String">asdf</Data></Cell>
<Cell ss:Index="10"><Data ss:Type="String">asdf</Data></Cell>
<Cell><Data ss:Type="String">asdf</Data></Cell>
<Cell><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell><Data ss:Type="String">sadfsdf</Data></Cell>
<Cell><Data ss:Type="String">asdfsdf</Data></Cell>
<Cell><Data ss:Type="String">asdf</Data></Cell>
<Cell><Data ss:Type="String">sadf</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="DateTime">2001-06-18T00:00:00.000</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="DateTime">2001-06-18T00:00:00.000</Data></Cell>
</Row>
...........................
.
.
.
.
.
i am going to use
SELECT extractVALUE(column_value, '//Row/Cell[1]/data')
,extractVALUE(column_value, '//Row/Cell[2]/data').
.
.
.
from table(Xmlsequence
(extract
(xmltype(bfilename('directory', 'xmlfile.xml'),
nls_charset_id('AL32UTF8')),
'/Workbook/Worksheet[1]/Table/Row'
)
)
)
but /Cell[1] cannot be usefull , some cell which has 'null' value does exist in the XML structure.. it use index to make the sequence
Rows wont match with each other because of that.
i am gonna use ss:index to extract the value even the null value....
but i dont know how...
any one help me?
-------------------------------------
also xmlns="urn:schemas-microsoft-com:office:spreadsheet"
with this in <workbook> query has results.
without this it has..
?????????????????????????
Edited by: user12008978 on Oct 1, 2010 12:42 PM