Skip to content

Commit 755a0a4

Browse files
trivikrAllanZhengYP
authored andcommitted
chore(codegen): move XML parser options from parse to XMLParser
1 parent 2c30299 commit 755a0a4

File tree

1 file changed

+4
-4
lines changed
  • codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen

1 file changed

+4
-4
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ static void generateXmlParseBody(GenerationContext context) {
159159
writer.openBlock("if (encoded.length) {", "}", () -> {
160160
// Temporararily creating parser inside the function.
161161
// Parser would be moved to runtime config in https://github.com/aws/aws-sdk-js-v3/issues/3979
162-
writer.write("const parsedObj = new XMLParser().parse(encoded, { attributeNamePrefix: '', "
163-
+ "ignoreAttributes: false, parseNodeValue: false, trimValues: false, "
164-
+ "tagValueProcessor: (val) => (val.trim() === '' && val.includes('\\n'))"
165-
+ " ? '': decodeHTML(val) });");
162+
writer.write("const parsedObj = new XMLParser({ attributeNamePrefix: '', "
163+
+ "ignoreAttributes: false, parseTagValue: false, trimValues: false, "
164+
+ "tagValueProcessor: (val) => (val.trim() === '' && val.includes('\\n'))"
165+
+ " ? '': decodeHTML(val) }).parse(encoded);");
166166
writer.write("const textNodeName = '#text';");
167167
writer.write("const key = Object.keys(parsedObj)[0];");
168168
writer.write("const parsedObjToReturn = parsedObj[key];");

0 commit comments

Comments
 (0)