ASF Bugzilla – Attachment 31295 Details for
Bug 51519
[PATCH] XSSFEventBasedExcelExtractor's Japanese xlsx file processing shouldn't extract t element within rPh elemtnts.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to ReadOnlySharedStringsTable to address this issue
51519.txt (text/plain), 2.61 KB, created by
Shaun Kalley
on 2014-02-07 21:27:08 UTC
(
hide
)
Description:
Patch to ReadOnlySharedStringsTable to address this issue
Filename:
MIME Type:
Creator:
Shaun Kalley
Created:
2014-02-07 21:27:08 UTC
Size:
2.61 KB
patch
obsolete
>diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java >index 8a4b139..30fe56f 100644 >--- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java >+++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java >@@ -29,7 +29,6 @@ import org.apache.poi.openxml4j.opc.OPCPackage; > import org.apache.poi.openxml4j.opc.PackagePart; > import org.apache.poi.openxml4j.opc.PackageRelationship; > import org.apache.poi.xssf.usermodel.XSSFRelation; >-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst; > import org.xml.sax.Attributes; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; >@@ -41,7 +40,10 @@ import org.xml.sax.helpers.DefaultHandler; > * table. Most of the text cells will reference something > * from in here. > * <p>Note that each SI entry can have multiple T elements, if the >- * string is made up of bits with different formatting. >+ * string is made up of bits with different formatting, though not >+ * all of these elements should be included. T elements within >+ * RPH elements, for example, are phonetic representations of the >+ * text and not part of the text itself. > * <p>Example input: > * <pre> > <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> >@@ -186,6 +188,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler { > > private StringBuffer characters; > private boolean tIsOpen; >+ private boolean rPhIsOpen; > > public void startElement(String uri, String localName, String name, > Attributes attributes) throws SAXException { >@@ -202,6 +205,8 @@ public class ReadOnlySharedStringsTable extends DefaultHandler { > characters.setLength(0); > } else if ("t".equals(name)) { > tIsOpen = true; >+ } else if ("rPh".equals(name)) { >+ rPhIsOpen = true; > } > } > >@@ -211,15 +216,17 @@ public class ReadOnlySharedStringsTable extends DefaultHandler { > strings.add(characters.toString()); > } else if ("t".equals(name)) { > tIsOpen = false; >+ } else if ("rPh".equals(name)) { >+ rPhIsOpen = false; > } > } > > /** >- * Captures characters only if a t(ext) element is open. >+ * Captures characters only if a (non-phonetic) t(ext) element is open. > */ > public void characters(char[] ch, int start, int length) > throws SAXException { >- if (tIsOpen) >+ if (tIsOpen && !rPhIsOpen) > characters.append(ch, start, length); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51519
:
28092
|
31165
| 31295 |
34805