chilts / awssum

(deprecated: use aws-sdk) Node.js modules for talking to lots of Web Service APIs.
Other
462 stars 57 forks source link

Impedance mismatch between XML parsing and XML generation #156

Closed keithmo closed 11 years ago

keithmo commented 11 years ago

The xml2js parser, as invoked by awssum, stores XML attributes in a JSON element named '@'.

The xml generator, on the other hand, assumes XML attributes are in a JSON element named '_attr'.

One side effect of this: You cannot retrieve an ACL via GetObjectAcl() then immediately write it via PutObjectAcl().

FWIW, xml2js does support an 'attrkey' option when creating the Parser object. As an experiment, I set this in awssum when creating the top-level parser, and the results of GetObjectAcl() can now be passed to PutObjectAcl(). I don't expect this to be a real solution, just an experiment.

chilts commented 11 years ago

Hiya,

I think this might be fixed in the latest version. I changed the data2xml() to expect '@' and '#'.

Can you try it out and let me know how it goes. I guess we each chose the other way to fix it ... but I hope that works for you.

It's been pushed to NPM as v1.1.1.

Cheers, Andy

keithmo commented 11 years ago

I'll be out-of-town all day today, but I'll test this tomorrow (Thursday). Thanks!

keithmo commented 11 years ago

FYI: Fix confirmed. Thanks!

chilts commented 11 years ago

That's great news! Many thanks for re-testing. :)