Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'localNSMap' of undefined #139

Closed
micah-williamson opened this issue Oct 23, 2015 · 2 comments
Closed

Cannot read property 'localNSMap' of undefined #139

micah-williamson opened this issue Oct 23, 2015 · 2 comments

Comments

@micah-williamson
Copy link

I'm trying to read a new article from the Daily Mail (sample: http://www.dailymail.co.uk/news/article-3286124/Four-injured-car-crashes-pavement-Guildford-Surrey.html) but getting the following error:

TypeError: Cannot read property 'localNSMap' of undefined
    at parse (C:\proj\dm-reader\node_modules\xmldom\sax.js:102:27)
    at Object.XMLReader.parse (C:\proj\dm-reader\node_modules\xmldom\sax.js:30:3)
    at DOMParser.parseFromString (C:\proj\dm-reader\node_modules\xmldom\dom-parser.js:25:7)
    at Request._callback (C:\proj\dm-reader\index.js:57:37)
    at Request.self.callback (C:\proj\dm-reader\node_modules\request\request.js:198:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (C:\proj\dm-reader\node_modules\request\request.js:1082:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
PS C:\proj\dm-reader> node .\index.js
C:\proj\dm-reader\node_modules\xmldom\sax.js:102
                        var localNSMap = config.localNSMap;

Is there something I can do to remedy this or is it a bug?

@teobugslayer
Copy link

A repro case:

var fileContents = '<Page></Page';

var domErrorHandler = function(level, str) { console.log("x"); };
var DomParser = require("xmldom").DOMParser;
var parser = new DomParser({ locator:{}, errorHandler: domErrorHandler });
parser.parseFromString(fileContents, "text/xml");

Note the missing closing >

@jindw
Copy link
Owner

jindw commented Jan 10, 2016

fixed in the latest version!

@jindw jindw closed this as completed Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants