-
Notifications
You must be signed in to change notification settings - Fork 578
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
fix(fast-xml-parser): populate contents from '#text' if available #993
fix(fast-xml-parser): populate contents from '#text' if available #993
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This comment has been minimized.
This comment has been minimized.
...pt-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a4948d0
to
55e686e
Compare
The update was verified by using modified version of code in https://github.com/trivikr/xml-parser-comparison: Code: const fastXmlParser = require("fast-xml-parser");
const { readFileSync } = require("fs");
const xmlData = readFileSync("example.xml").toString();
const parsedObj = fastXmlParser.parse(xmlData, {
attributeNamePrefix: "",
ignoreAttributes: false
});
const textNodeName = "#text";
const key = Object.keys(parsedObj)[0];
const parsedObjToReturn = parsedObj[key];
if (parsedObjToReturn[textNodeName]) {
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
delete parsedObjToReturn[textNodeName];
}
console.log(JSON.stringify(parsedObjToReturn, null, 2)); When <?xml version="1.0"?>
<AccessControlPolicy
xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<DisplayName>trivikr</DisplayName>
</Owner>
</AccessControlPolicy> Output is: {
"xmlns": "http://s3.amazonaws.com/doc/2006-03-01/",
"Owner": {
"DisplayName": "trivikr"
}
} When <?xml version="1.0"?>
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">EU</LocationConstraint> Output is: {
"xmlns": "http://s3.amazonaws.com/doc/2006-03-01/",
"LocationConstraint": "EU"
} |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Issue #, if available:
Option 2 for fixing #987
Description of changes:
node_modules/@aws-sdk/client-s3/dist/cjs/protocols/Aws_restXml.js
with the reproducible code given in s3.getBucketLocation returns undefined for LocationConstraint #987By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.