poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r644692 - in /poi/branches/ooxml/src: documentation/content/xdocs/spreadsheet/how-to.xml examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
Date Fri, 04 Apr 2008 12:24:41 GMT
Author: nick
Date: Fri Apr  4 05:24:38 2008
New Revision: 644692

URL: http://svn.apache.org/viewvc?rev=644692&view=rev
Log:
Fix an off-by-one in the xssf eventmodel example and docs

Modified:
    poi/branches/ooxml/src/documentation/content/xdocs/spreadsheet/how-to.xml
    poi/branches/ooxml/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java

Modified: poi/branches/ooxml/src/documentation/content/xdocs/spreadsheet/how-to.xml
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/spreadsheet/how-to.xml?rev=644692&r1=644691&r2=644692&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/spreadsheet/how-to.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/spreadsheet/how-to.xml Fri Apr  4 05:24:38
2008
@@ -542,10 +542,12 @@
 
 		Iterator<InputStream> sheets = r.getSheetsData();
 		while(sheets.hasNext()) {
+			System.out.println("Processing new sheet:\n");
 			InputStream sheet = sheets.next();
 			InputSource sheetSource = new InputSource(sheet);
 			parser.parse(sheetSource);
 			sheet.close();
+			System.out.println("");
 		}
 	}
 
@@ -578,13 +580,19 @@
 				// Print the cell reference
 				System.out.print(attributes.getValue("r") + " - ");
 				// Figure out if the value is an index in the SST
-				if(attributes.getValue("t").equals("s")) {
+				String cellType = attributes.getValue("t");
+				if(cellType != null && cellType.equals("s")) {
 					nextIsString = true;
 				} else {
 					nextIsString = false;
 				}
 			}
+		}
+		
+		public void endElement(String uri, String localName, String name)
+				throws SAXException {
 			// v => contents of a cell
+			// Output after we've seen the string contents
 			if(name.equals("v")) {
 				System.out.println(lastContents);
 			}

Modified: poi/branches/ooxml/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java?rev=644692&r1=644691&r2=644692&view=diff
==============================================================================
--- poi/branches/ooxml/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
(original)
+++ poi/branches/ooxml/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
Fri Apr  4 05:24:38 2008
@@ -58,10 +58,12 @@
 
 		Iterator<InputStream> sheets = r.getSheetsData();
 		while(sheets.hasNext()) {
+			System.out.println("Processing new sheet:\n");
 			InputStream sheet = sheets.next();
 			InputSource sheetSource = new InputSource(sheet);
 			parser.parse(sheetSource);
 			sheet.close();
+			System.out.println("");
 		}
 	}
 
@@ -94,13 +96,19 @@
 				// Print the cell reference
 				System.out.print(attributes.getValue("r") + " - ");
 				// Figure out if the value is an index in the SST
-				if(attributes.getValue("t").equals("s")) {
+				String cellType = attributes.getValue("t");
+				if(cellType != null && cellType.equals("s")) {
 					nextIsString = true;
 				} else {
 					nextIsString = false;
 				}
 			}
+		}
+		
+		public void endElement(String uri, String localName, String name)
+				throws SAXException {
 			// v => contents of a cell
+			// Output after we've seen the string contents
 			if(name.equals("v")) {
 				System.out.println(lastContents);
 			}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message