我对命名空间的工作方式感到困惑。我正在尝试获取worksheet
wheress:Name="Datagrid"
并从中获取data
节点 wherename="emailname"
Imports <xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
Module Module1
Sub Main()
Dim xmlFile As String = System.AppDomain.CurrentDomain.BaseDirectory & "Datagrid.xml"
Dim root As XElement = XElement.Load(xmlFile)
''select worksheet where ss:Name="Datagrid""
'Dim dg = From item In root .......................
''get data from wokrsheet...table..row...data where = name="emailname" (not ss:name="emailname")
'Dim data = From item In dg .......................
End Sub
End Module
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">
<Worksheet ss:Name="Datagrid">
<Table ss:ExpandedColumnCount="13" ss:ExpandedRowCount="11" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Row ss:Index="3" ss:AutoFitHeight="0">
<Cell Name="emailname">
<Data ss:Type="String">email address</Data>
</Cell>
</Row>
<Row ss:Index="4" ss:AutoFitHeight="0">
<Cell Name="username">
<Data ss:Type="String">user name</Data>
</Cell>
</Row>
</Table>
</Worksheet>
<Worksheet ss:Name="Properties">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="3" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Row>
<Cell>
<Data ss:Type="Number">1</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="Number">2</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="Number">3</Data>
</Cell>
</Row>
</Table>
</Worksheet>
</Workbook>