diff --git a/package.json b/package.json
index e9dc0f1..f74f153 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "xlsx",
- "version": "0.0.3",
+ "version": "0.0.4",
"author": "Niggler",
"description": "(one day) a full-featured XLSX parser and writer. For now, primitive parser",
"keywords": [
diff --git a/xlsx.js b/xlsx.js
index 133d0ae..df10083 100644
--- a/xlsx.js
+++ b/xlsx.js
@@ -99,6 +99,7 @@ function parseSheet(data) { //TODO: use a real xml parser
//s.rows = {};
//s.cells = {};
var q = ["v","f"];
+ if(!data.match(//))
data.match(/(.*)<\/sheetData>/)[1].split("").forEach(function(x) { if(x === "") return;
var row = parsexmltag(x.match(/]*>/)[0]); //s.rows[row.r]=row.spans;
var cells = x.substr(x.indexOf('>')+1).split("");
@@ -129,10 +130,12 @@ function matchtag(f,g) {return new RegExp('<' + f + '>(.*)' + f + '>',g||"");}
function parseStrs(data) {
var s = [];
var sst = data.match(new RegExp("]*)>(.*)<\/sst>"));
- s = sst[2].replace(//g,"").split(/<\/si>/).map(function(x) { var z = {};
- var y=x.match(/<(.*)>(.*)<\/.*/); if(x) z[y[1]]=unescapexml(y[2]); return z;});
+ if(sst) {
+ s = sst[2].replace(//g,"").split(/<\/si>/).map(function(x) { var z = {};
+ var y=x.match(/<(.*)>(.*)<\/.*/); if(x) z[y[1]]=unescapexml(y[2]); return z;});
- sst = parsexmltag(sst[1]); s.count = sst.count; s.uniqueCount = sst.uniqueCount;
+ sst = parsexmltag(sst[1]); s.count = sst.count; s.uniqueCount = sst.uniqueCount;
+ }
if(debug) s.rawdata = data;
return s;
}
@@ -143,7 +146,7 @@ function parseProps(data) {
var bools = ["HyperlinksChanged","SharedDoc","LinksUpToDate","ScaleCrop"];
var xtra = ["HeadingPairs", "TitlesOfParts","dc:creator","cp:lastModifiedBy","dcterms:created", "dcterms:modified"];
- strings.forEach(function(f){p[f] = data.match(matchtag(f))[1];});
+ strings.forEach(function(f){p[f] = (data.match(matchtag(f))||[])[1];});
bools.forEach(function(f){p[f] = data.match(matchtag(f))[1] == "true";});
xtra.forEach(function(f){q[f] = data.match(new RegExp("<" + f + "[^>]*>(.*)<\/" + f + ">"))[1];});