]> gerrit.simantics Code Review - simantics/interop.git/blob - org.simantics.excel.poi/src/org/simantics/excel/poi/parser/streaming/XSSWorkbookHandler.java
Reducing use of deprecated code: using CellType enum instead of int for
[simantics/interop.git] / org.simantics.excel.poi / src / org / simantics / excel / poi / parser / streaming / XSSWorkbookHandler.java
1 package org.simantics.excel.poi.parser.streaming;\r
2 \r
3 import java.util.ArrayList;\r
4 import java.util.List;\r
5 \r
6 import org.xml.sax.Attributes;\r
7 import org.xml.sax.SAXException;\r
8 import org.xml.sax.helpers.DefaultHandler;\r
9 \r
10 public class XSSWorkbookHandler extends DefaultHandler {\r
11 \r
12         \r
13         \r
14         List<SheetImpl> sheets = new ArrayList<SheetImpl>();\r
15         \r
16 \r
17         public List<SheetImpl> getSheets() {\r
18                 return sheets;\r
19         }\r
20         \r
21         public void startElement(String uri, String localName, String name,\r
22                         Attributes attributes) throws SAXException {\r
23 //              System.out.println(name);\r
24 //              for (int i = 0; i < attributes.getLength(); i++) {\r
25 //                      System.out.println("  " + attributes.getLocalName(i) + "; "+attributes.getValue(i) + "; " + attributes.getType(i) );\r
26 //                      \r
27 //              }\r
28                 if(name.equals("sheet")) {\r
29                         String sheetName = attributes.getValue("name");\r
30                         String sheetId = attributes.getValue("sheetId");\r
31                         String id = attributes.getValue("id");\r
32                         sheets.add(new SheetImpl(sheetName, Integer.parseInt(sheetId), id));\r
33                 } \r
34 \r
35         }\r
36         \r
37         public void endElement(String uri, String localName, String name)\r
38                         throws SAXException {\r
39         \r
40         }\r
41 \r
42         public void characters(char[] ch, int start, int length)\r
43                         throws SAXException {\r
44                 \r
45         }\r
46 \r
47 }\r