JAVA 对于EXCEL2003的XML格式文件的解析

豁达的木奉木奉米唐 2016-05-23 05:18:34
对于这种的excel如何解析?以下是片段:
<?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">
<Title>项目名称</Title>
<LastAuthor>Windows 用户</LastAuthor>
<Created>2016-05-11T06:17:39Z</Created>
<Version>11.9999</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>13680</WindowHeight>
<WindowWidth>28035</WindowWidth>
<WindowTopX>360</WindowTopX>
<WindowTopY>60</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Center"/>
<Borders/>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="12"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s23">
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="12" ss:Color="#000000"/>
</Style>
<Style ss:ID="s25">
<Alignment ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font x:Family="Swiss" ss:Color="#000000" ss:Bold="1"/>
</Style>
<Style ss:ID="s26">
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="12" ss:Color="#000000"/>
</Style>
<Style ss:ID="s27">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="12" ss:Color="#000000"/>
<Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s28">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="12" ss:Color="#000000"/>
</Style>
<Style ss:ID="s29">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="12" ss:Color="#000000"/>
</Style>
<Worksheet ss:Name="2019年世园会项目工程进度计划11.2全--3.7版本">
<Table ss:ExpandedColumnCount="21" ss:ExpandedRowCount="341" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s23" ss:DefaultColumnWidth="54"
ss:DefaultRowHeight="14.25">
<Column ss:StyleID="s23" ss:Width="216"/>
<Column ss:StyleID="s23" ss:Width="57"/>
<Column ss:StyleID="s23" ss:Width="216" ss:Span="1"/>
<Column ss:Index="5" ss:StyleID="s23" ss:Width="103.5"/>
<Column ss:StyleID="s23" ss:Width="110.25"/>
<Column ss:StyleID="s23" ss:AutoFitWidth="0" ss:Width="27"/>
<Column ss:StyleID="s23" ss:AutoFitWidth="0" ss:Width="45"/>
<Column ss:StyleID="s23" ss:Width="57"/>
<Column ss:StyleID="s23" ss:Width="136.5"/>
<Column ss:StyleID="s23" ss:Width="83.25"/>
<Column ss:StyleID="s23" ss:Width="57"/>
<Column ss:StyleID="s23" ss:Width="110.25"/>
<Column ss:StyleID="s23" ss:Width="57"/>
<Column ss:StyleID="s23" ss:AutoFitWidth="0" ss:Width="45"/>
<Column ss:StyleID="s23" ss:Width="216"/>
<Column ss:StyleID="s23" ss:Width="57"/>
<Column ss:StyleID="s23" ss:AutoFitWidth="0" ss:Width="45"/>
<Column ss:StyleID="s23" ss:Width="57" ss:Span="2"/>
<Row ss:Height="25.5">
<Cell ss:StyleID="s25"><Data ss:Type="String">2019年世园会项目工程进度计划11.2全--3.7版本</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s26"/>
</Row>
<Row>
<Cell ss:StyleID="s27"><Data ss:Type="String">编号</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">WBS码</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">前置任务</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">任务名称</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">开始时间</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">结束时间</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="Number">11</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">文本20</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">工期</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">局内牵头部门</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">局外配合部门</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">所属地块</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">投资主体</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">用地性质</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">投资额</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">前提条件</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">协作单位</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">负责人</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">交付成果</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">任务来源</Data></Cell>
<Cell ss:StyleID="s27"><Data ss:Type="String">进展状态</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s28"><Data ss:Type="Number">1</Data></Cell>
<Cell ss:StyleID="s28"><Data ss:Type="Number">1</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s28"><Data ss:Type="String">政府投资项目</Data></Cell>
<Cell ss:StyleID="s31"><Data ss:Type="DateTime">2016-01-01T08:00:00.000</Data></Cell>
<Cell ss:StyleID="s31"><Data ss:Type="DateTime">2019-02-22T18:00:00.000</Data></Cell>
<Cell ss:StyleID="s29"><Data ss:Type="Number">1</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"><Data ss:Type="String">919天</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
</Row>
<Row>
<Cell ss:StyleID="s28"><Data ss:Type="Number">2</Data></Cell>
<Cell ss:StyleID="s28"><Data ss:Type="Number">1.1</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s32"><Data ss:Type="String">中国馆、国际馆</Data></Cell>
<Cell ss:StyleID="s31"><Data ss:Type="DateTime">2016-01-01T08:00:00.000</Data></Cell>
<Cell ss:StyleID="s31"><Data ss:Type="DateTime">2018-10-14T18:00:00.000</Data></Cell>
<Cell ss:StyleID="s29"><Data ss:Type="Number">2</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"><Data ss:Type="String">788天</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
</Row>
<Row>
<Cell ss:StyleID="s28"><Data ss:Type="Number">3</Data></Cell>
<Cell ss:StyleID="s28"><Data ss:Type="String">1.1.1</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s32"><Data ss:Type="String">项目前期手续</Data></Cell>
<Cell ss:StyleID="s31"><Data ss:Type="DateTime">2016-02-20T08:00:00.000</Data></Cell>
<Cell ss:StyleID="s31"><Data ss:Type="DateTime">2016-07-30T08:00:00.000</Data></Cell>
<Cell ss:StyleID="s29"><Data ss:Type="Number">3</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"><Data ss:Type="String">161天</Data></Cell>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
<Cell ss:StyleID="s29"/>
...全文
372 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ZiglarXie 2016-05-27
  • 打赏
  • 举报
回复
标准xml直接用 sax就可以解析了
ZiglarXie 2016-05-27
  • 打赏
  • 举报
回复
我有个很烂的博客 讲了这个的原理
loveunittesting 2016-05-26
  • 打赏
  • 举报
回复
我记得poi可以解析的,只不过格式好像不是hssf了
  • 打赏
  • 举报
回复
引用 3 楼 yys79 的回复:
没太明白,直接用poi不行吗?
不可以的~~这样的文件用文本打开类似XML格式,而正常的excel文件是不能用文本打开的
loveunittesting 2016-05-24
  • 打赏
  • 举报
回复
没太明白,直接用poi不行吗?
  • 打赏
  • 举报
回复
有没有人能支个招~~
  • 打赏
  • 举报
回复
主要的数据在<Row> 下的<Cell> 的<Data>

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧