Skip to content

Commit 0af728b

Browse files
committed
Use XMLParser API from fast-xml-parser 4.x
1 parent 14653ce commit 0af728b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ private String registerBodyComparatorStub(String mediaType) {
575575
case "application/xml":
576576
writer.addDependency(TypeScriptDependency.XML_PARSER);
577577
writer.addDependency(TypeScriptDependency.HTML_ENTITIES);
578-
writer.addImport("parse", "xmlParse", "fast-xml-parser");
578+
writer.addImport("XMLParser", null, "fast-xml-parser");
579579
writer.addImport("decodeHTML", "decodeHTML", "entities");
580580
additionalStubs.add("protocol-test-xml-stub.ts");
581581
return "compareEquivalentXmlBodies(bodyString, r.body.toString())";

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/protocol-test-xml-stub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ const compareEquivalentXmlBodies = (
99
const parseConfig = {
1010
attributeNamePrefix: "",
1111
ignoreAttributes: false,
12-
parseNodeValue: false,
12+
parseTagValue: false,
1313
trimValues: false,
1414
tagValueProcessor: (val: any, tagName: any) =>
1515
val.trim() === "" ? "" : decodeHTML(val),
1616
};
1717

1818
const parseXmlBody = (body: string) => {
19-
const parsedObj = xmlParse(body, parseConfig);
19+
const parsedObj = new XMLParser(parseConfig).parse(body);
2020
const textNodeName = "#text";
2121
const key = Object.keys(parsedObj)[0];
2222
const parsedObjToReturn = parsedObj[key];

0 commit comments

Comments
 (0)