You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/04/04 14:24:41 UTC

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

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