Fix prefixed shared strings XML file (#450)
A prefixed sharedStrings.xml file was not properly read, as we were comparing the un-prefixed name with the possible prefixed name. Also, this commit contains a fix for sheets with rows not starting at column A.
This commit is contained in:
1 parent
ee5dee61c7
commit
6d44cd26cc
6 files changed
+42
-3
No files matched your search
@@ -164,4 +164,12 @@ class XMLReader extends \XMLReader
|
||||
|
||||
return ($this->nodeType === $nodeType && $currentNodeName === $nodeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The name of the current node, un-prefixed
|
||||
*/
|
||||
public function getCurrentNodeName()
|
||||
{
|
||||
return $this->localName;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class SharedStringsHelper
|
||||
|
||||
$xmlReader->readUntilNodeFound(self::XML_NODE_SI);
|
||||
|
||||
while ($xmlReader->name === self::XML_NODE_SI) {
|
||||
while ($xmlReader->getCurrentNodeName() === self::XML_NODE_SI) {
|
||||
$this->processSharedStringsItem($xmlReader, $sharedStringIndex);
|
||||
$sharedStringIndex++;
|
||||
|
||||
@@ -128,7 +128,7 @@ class SharedStringsHelper
|
||||
$xmlReader->next(self::XML_NODE_SST);
|
||||
|
||||
// Iterate over the "sst" elements to get the actual "sst ELEMENT" (skips any DOCTYPE)
|
||||
while ($xmlReader->name === self::XML_NODE_SST && $xmlReader->nodeType !== XMLReader::ELEMENT) {
|
||||
while ($xmlReader->getCurrentNodeName() === self::XML_NODE_SST && $xmlReader->nodeType !== XMLReader::ELEMENT) {
|
||||
$xmlReader->read();
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ class RowIterator implements IteratorInterface
|
||||
*/
|
||||
protected function isEmptyRow($rowData)
|
||||
{
|
||||
return (count($rowData) === 1 && $rowData[0] === '');
|
||||
return (count($rowData) === 1 && key($rowData) === '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user