0
我试图读取由excel生成的一些xml到Android。即时通讯使用Simplexml来做到这一点。android使用simplexml读取xml
即使将行列入列表,IM也遇到了麻烦。我得到的错误是... “org.simpleframework.xml.core.PersistenceException:元素'行'已与@ org.simpleframework.xml.ElementList一起使用”...
但我不知道为什么。任何想法为什么?
的XML看起来像这样...
<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel">
<Worksheet ss:Name="DDDDDDDDDDDDDD">
<Table ss:ExpandedColumnCount="20" ss:ExpandedRowCount="2672" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
<Row>
<Cell>
<Data ss:Type="Number">123</Data>
</Cell>
<Cell ss:Index="4">
<Data ss:Type="Number">4</Data>
</Cell>
<Cell ss:Index="6">
<Data ss:Type="String">sdinmsd</Data>
</Cell>
<Cell ss:Index="9">
<Data ss:Type="String">dsddf</Data>
</Cell>
<Cell ss:Index="11">
<Data ss:Type="String">sdsdsd 1AB</Data>
</Cell>
<Cell>
<Data ss:Type="String">S06Cvcvvc28048</Data>
</Cell>
<Cell>
<Data ss:Type="String">Kdfdf</Data>
</Cell>
<Cell>
<Data ss:Type="Number">1dfd</Data>
</Cell>
<Cell>
<Data ss:Type="Number">835df</Data>
</Cell>
<Cell>
<Data ss:Type="Number">102df</Data>
</Cell>
<Cell>
<Data ss:Type="Number">393df</Data>
</Cell>
<Cell>
<Data ss:Type="Number">2012dfdf1005</Data>
</Cell>
<Cell>
<Data ss:Type="String">New Custdfdfomer</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="Number">123</Data>
</Cell>
<Cell ss:Index="4">
<Data ss:Type="Number">4</Data>
</Cell>
<Cell ss:Index="6">
<Data ss:Type="String">sdinmsd</Data>
</Cell>
<Cell ss:Index="9">
<Data ss:Type="String">dsddf</Data>
</Cell>
<Cell ss:Index="11">
<Data ss:Type="String">sdsdsd 1AB</Data>
</Cell>
<Cell>
<Data ss:Type="String">S06Cvcvvc28048</Data>
</Cell>
<Cell>
<Data ss:Type="String">Kdfdf</Data>
</Cell>
<Cell>
<Data ss:Type="Number">1dfd</Data>
</Cell>
<Cell>
<Data ss:Type="Number">835df</Data>
</Cell>
<Cell>
<Data ss:Type="Number">102df</Data>
</Cell>
<Cell>
<Data ss:Type="Number">393df</Data>
</Cell>
<Cell>
<Data ss:Type="Number">2012dfdf1005</Data>
</Cell>
<Cell>
<Data ss:Type="String">New Custdfdfomer</Data>
</Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
和我解析的代码看起来像这样...
@Root(strict = false)
public class LocksXmlDisplay {
@Element (name = "Worksheet")
private Worksheet worksheet;
public Worksheet getWorksheet() {
return worksheet;
}
@Root(strict = false)
public static class Worksheet {
@Element (name = "Table")
private Tables tables;
public Tables gettables() {
return tables;
}
@Root(strict = false)
public static class Tables {
@ElementList(name = "Row")
private List<Row> list;
public List getrows() {
return list;
}
@Root(strict = false)
public static class Row {
}
}
}
}