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 2016/02/23 23:24:09 UTC

svn commit: r1731986 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java

Author: nick
Date: Tue Feb 23 22:24:09 2016
New Revision: 1731986

URL: http://svn.apache.org/viewvc?rev=1731986&view=rev
Log:
#59021 Namespace aware processing fix for ReadOnlySharedStringsTable, to match the one recently added to XSSFSheetXMLHandler

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java?rev=1731986&r1=1731985&r2=1731986&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java Tue Feb 23 22:24:09 2016
@@ -16,6 +16,8 @@
 ==================================================================== */
 package org.apache.poi.xssf.eventusermodel;
 
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_SPREADSHEETML;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -193,7 +195,11 @@ public class ReadOnlySharedStringsTable
 
     public void startElement(String uri, String localName, String name,
                              Attributes attributes) throws SAXException {
-        if ("sst".equals(name)) {
+        if (uri != null && ! uri.equals(NS_SPREADSHEETML)) {
+            return;
+        }
+        
+        if ("sst".equals(localName)) {
             String count = attributes.getValue("count");
             if(count != null) this.count = Integer.parseInt(count);
             String uniqueCount = attributes.getValue("uniqueCount");
@@ -202,18 +208,22 @@ public class ReadOnlySharedStringsTable
             this.strings = new ArrayList<String>(this.uniqueCount);
 
             characters = new StringBuffer();
-        } else if ("si".equals(name)) {
+        } else if ("si".equals(localName)) {
             characters.setLength(0);
-        } else if ("t".equals(name)) {
+        } else if ("t".equals(localName)) {
             tIsOpen = true;
         }
     }
 
     public void endElement(String uri, String localName, String name)
             throws SAXException {
-        if ("si".equals(name)) {
+        if (uri != null && ! uri.equals(NS_SPREADSHEETML)) {
+            return;
+        }
+        
+        if ("si".equals(localName)) {
             strings.add(characters.toString());
-        } else if ("t".equals(name)) {
+        } else if ("t".equals(localName)) {
            tIsOpen = false;
         }
     }



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