Skip to content

Commit

Permalink
Adding parser options
Browse files Browse the repository at this point in the history
  • Loading branch information
seantomburke committed Nov 8, 2024
1 parent 7611022 commit 79d6112
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/assets/sitemapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,20 @@ export default class Sitemapper {
}

// Parse XML using fast-xml-parser
const parser = new XMLParser();
const parser = new XMLParser({
ignoreAttributes: false,
attributeNamePrefix: '',
textNodeName: '_text',
parseTagValue: true,
trimValues: true,
parseAttributeValue: true,
allowBooleanAttributes: true,
cdataTagName: '__cdata',
htmlEntities: true,
ignoreNameSpace: true,
parseTrueNumberOnly: true,
});

const data = parser.parse(responseBody.toString());

// return the results
Expand Down Expand Up @@ -449,8 +462,8 @@ export default class Sitemapper {
* @param {Buffer} body - body of the gzipped file
* @returns {boolean}
*/
decompressResponseBody(body) {
return new Promise((resolve, reject) => {
async decompressResponseBody(body) {
return await new Promise((resolve, reject) => {
const buffer = Buffer.from(body);
zlib.gunzip(buffer, (err, result) => {
if (err) {
Expand Down

0 comments on commit 79d6112

Please sign in to comment.