-
Notifications
You must be signed in to change notification settings - Fork 607
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
mergeAttrs true behaviour changes #110
Comments
Which |
Here is example of xml tag: <outline xmlUrl="http://www.futurity.org/feed/"/> |
I'm using heroku so after today deploy it stoped work as before becasue of provided xml is parsed as { xmlUrl: [ 'http://www.futurity.org/feed', pathname: '/' ] } it was expected to be just { xmlUrl: 'http://www.futurity.org/feed' } heroku do clear npm install every release, so I did not catch it locally |
evenmore - looks like every tag attributes are parsed now as array |
Can't reproduce at all: {parseString} = require 'xml2js'
xml = '<outline htmlUrl="futurity.org" text="Futurity.org" title="Futurity.org" type="rss" xmlUrl="http://www.futurity.org/feed/"/>'
parseString xml, (err, result) ->
console.dir result Parses correctly to: { outline:
{ '$':
{ htmlUrl: 'futurity.org',
text: 'Futurity.org',
title: 'Futurity.org',
type: 'rss',
xmlUrl: 'http://www.futurity.org/feed/' } } } Please provide example code to reproduce your issue. |
looks like it is related to mergeAttrs setting var xml2js = require('xml2js');
var parser = new xml2js.Parser({
mergeAttrs: true
});
parser.parseString('<outline xmlUrl="http://www.futurity.org/feed/"/>', function (err, result) {
console.dir(result);
}); |
Alright, that would have shortened the search. Check what happened in #101. |
oki, thanks for help. Did not get initially that is could be related to mergeAttrs. |
Yes, I agree. I should add that to the readme. |
Not sure what is changed in latest release but before following xmlUrl attribute was parsed as single string. Now it is parsed as array.
Input:
Output:
is it expected behaviour/change?
The text was updated successfully, but these errors were encountered: