Всем привет, есть книга excel в формате xml 2003.
Не получается ее распарсить с помощью xml.nodes
Структура xml:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
<?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>xxx</Author>
<LastAuthor>xxxxxxxx</LastAuthor>
<Created>2019-07-26T14:18:48Z</Created>
<Version>16.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>8700</WindowHeight>
<WindowWidth>24000</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>0</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:CharSet="204" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:CharSet="204" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<NumberFormat ss:Format="@"/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom" ss:WrapText="1"/>
<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>
<Font ss:FontName="Arial" x:CharSet="204" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<NumberFormat ss:Format="@"/>
</Style>
<Style ss:ID="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="Arial" x:CharSet="204" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<NumberFormat ss:Format="@"/>
</Style>
<Style ss:ID="s70">
<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>
<Font ss:FontName="Arial" x:CharSet="204" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<NumberFormat ss:Format="#,##0"/>
</Style>
<Style ss:ID="s73">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="Arial" x:CharSet="204" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<Interior ss:Color="#FFFF00" ss:Pattern="Solid"/>
<NumberFormat ss:Format="@"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="541" ss:ExpandedRowCount="6" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s62" ss:DefaultRowHeight="14.25">
<Column ss:StyleID="s62" ss:Width="86.25"/>
<Column ss:StyleID="s62" ss:Width="73.5" ss:Span="1"/>
<Column ss:Index="4" ss:StyleID="s62" ss:Width="200.25" ss:Span="537"/>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="2" ss:StyleID="s67"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">ФИО</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Грейд</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Ранг</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s70"><Data ss:Type="Number">1</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="Number">2</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="Number">3</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]Никулина О.И[/color][/color]</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]7[/color][/color]</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]1[/color][/color]</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]Николаева А.В[/color][/color]</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]6[/color][/color]</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]2[/color][/color]</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]Сидорова Н.П[/color][/color]</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]9[/color][/color]</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">[color=red][color=red]6[/color][/color]</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.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>9</ActiveRow>
<ActiveCol>4</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<Table ss:ExpandedColumnCount="541" ss:ExpandedRowCount="6" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s62" ss:DefaultRowHeight="14.25">
<Column ss:StyleID="s62" ss:Width="86.25"/>
<Column ss:StyleID="s62" ss:Width="73.5" ss:Span="1"/>
<Column ss:Index="4" ss:StyleID="s62" ss:Width="200.25" ss:Span="537"/>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="2" ss:StyleID="s73"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">ФИО</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Грейд</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Ранг</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s70"><Data ss:Type="Number">1</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="Number">2</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="Number">3</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">Иванов И.И</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">5</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">2</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">Петров А.А</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">3</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">4</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s63"><Data ss:Type="String">Сидоров О.О</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">1</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">6</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.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Zoom>70</Zoom>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>3</ActiveRow>
<ActiveCol>1</ActiveCol>
<RangeSelection>R4C2:R6C3</RangeSelection>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
На выходе я хочу получить 2 таблицы одна с листа 1, вторая с листа 2
Делаю
1.
DECLARE @X XML = (SELECT * FROM OPENROWSET (BULK 'С:\TEST.XML', SINGLE_CLOB) t)
А дальше загвоздка с путями в методе nodes, как ни пишу получаю пустоту.
Как написать запрос типа :
1.
2.
3.
4.
SELECT T.c.value('???','VARCHAR(50)') as fio,
T.c.value('???','INT') as graid,
T.c.value('???','INT') as rang
FROM @X.nodes('????') as t (c)
чтобы получить таблицу вида:
ФИО Грейд Ранг
Иванов И.И 5 2
Петров А.А 3 4
Сидоров О.О 1 6