Auslesen von Werten
aus einer xml-Datei (basierend auf Excel)
Gegeben ist folgende
Excel-Tabelle:

Daraus ergibt
sich folgende xml-Datei: (Speichern aus Excel als
XML-Kalkulationstabelle 2003 (*.xml) )
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Amstutz Ueli</Author>
<LastAuthor>Amstutz Ueli</LastAuthor>
<Created>2015-04-02T12:57:21Z</Created>
<LastSaved>2015-04-02T13:01:15Z</LastSaved>
<Company>Opacc Laboratory AG</Company>
<Version>15.10</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>11310</WindowHeight>
<WindowWidth>16515</WindowWidth>
<WindowTopX>600</WindowTopX>
<WindowTopY>135</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62">
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000" ss:Bold="1"/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Indent="1"/>
<Interior ss:Color="#F3F3F3" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s64">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Indent="1"/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior ss:Color="#F3F3F3" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s65">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Indent="1" ss:WrapText="1"/>
<Interior ss:Color="#F3F3F3" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s70">
<Interior ss:Color="#F2F2F2" ss:Pattern="Solid"/>
<NumberFormat ss:Format="Short Date"/>
</Style>
</Styles>
<Worksheet ss:Name="Tabelle1">
<Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="7" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="60" ss:DefaultRowHeight="15">
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s62"><Data ss:Type="String">Nummer</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="String">Vorname</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="String">Name</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="String">Kürzel</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="String">Datum</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="Number">36454</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">Andreas</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Boller</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">AB</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="DateTime">1992-08-01T00:00:00.000</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="Number">36713</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">Albrecht</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Stalder</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">AS</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="DateTime">1998-09-01T00:00:00.000</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="Number">34132</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">Albin</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Arnold</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">AA</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="DateTime">1990-10-01T00:00:00.000</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="Number">35517</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">Alexander</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Zempp</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">AZ</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="DateTime">1990-11-01T00:00:00.000</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="Number">36795</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">Andrea Laura</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Gerber</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">AG</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="DateTime">2000-12-01T00:00:00.000</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="Number">36314</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">Andreas</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Kraft</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">AK</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="DateTime">2010-12-31T00:00:00.000</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.78740157499999996" x:Left="0.7" x:Right="0.7" x:Top="0.78740157499999996"/>
</PageSetup>
<Unsynced/>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>14</ActiveRow>
<ActiveCol>2</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
Request für das Kopieren und Ausführen in der
OpaccOXAS LiveDocumentation:
Common.XmlQuery
SourceFile=example4.xml
Namespace=ns,urn:schemas-microsoft-com:office:spreadsheet
Headers=/ns:Workbook/ns:Worksheet/ns:Table/ns:Row[1]/ns:Cell/ns:Data
Rows=/ns:Workbook/ns:Worksheet/ns:Table/ns:Row[position()>1]
Values=ns:Cell/ns:Data
Ausgeben aller Spalten und
Rows:

Request für das Kopieren
und Ausführen in der OpaccOXAS LiveDocumentation:
Common.XmlQuery
SourceFile=example4.xml
Namespace=ns,urn:schemas-microsoft-com:office:spreadsheet
Column=Eintrittsdatum,/ns:Workbook/ns:Worksheet/ns:Table/ns:Row[position()>1]/ns:Cell[5]/ns:Data
Ausgeben
der Datum-Spalte:

Das Datum
wird per Default in einem Format zurückgegeben, das für unsere Zwecke
meist nicht geeignet ist.
Sie können das Datum mit Hilfe der
Funktionen concat() und substring() gemäss Ihren
Anforderungen formatieren.
Beispiel:
Der String
1992-08-01T00:00:00.000 wird mit der Funktion substring() geteilt.
Zwei Zeichen ab Stelle neun, zwei Zeichen ab Stelle sechs und vier Zeichen
ab Stelle 1.
Die drei Substrings werden dann mit der Funktion
concat() wieder zusammengesetzt. Zwischen jeden Substring wird
dabei noch ein Punkt gesetzt.
Column=Eintrittdsdatum,concat(substring(ns:Cell[5]/ns:Data,9,2), '.', substring(ns:Cell[5]/ns:Data,6,2), '.', substring(ns:Cell[5]/ns:Data,1,4))
Request
für das Kopieren und Ausführen in der OpaccOXAS
LiveDocumentation:
Common.XmlQuery
SourceFile=example4.xml
Namespace=ns,urn:schemas-microsoft-com:office:spreadsheet
Rows=/ns:Workbook/ns:Worksheet/ns:Table/ns:Row[position()>1]
Column=Eintrittdsdatum,concat(substring(ns:Cell[5]/ns:Data,9,2), '.', substring(ns:Cell[5]/ns:Data,6,2), '.', substring(ns:Cell[5]/ns:Data,1,4))
Ausgeben
der Datum-Spalte: