Closed branewyn closed 2 years ago
I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.
@branewyn can you please post the code you used to parse? along with options you're passing and FXP version
4.0.7
const builder = new XMLBuilder(); const xmlContent = builder.build(data)
This is the standard usage as per the user guide
Have you hardcoded your input and tried
{
address: {
city: { },
street: 'that is a thing hey',
},
_id: new ObjectId("626126118baaa602b96f15fa"),
type: 'SYSTEM',
value: {
API_KEY: '0702730074msh0fe47ec6bd19b1e457e'
},
deleted: true,
createdBy: new ObjectId("6234d37fe1f8f7e7d8334b61"),
`: new ObjectId("6234d37fe1f8f7e7d8334b61"),
createdAt: 2022 - 04 - 21T09: 38: 25.011Z,
updatedAt: 2022 - 04 - 21T09: 38: 25.011Z,
name: 'Public Holiday API Key 2'
}
This is the sample I took from your example, Check _id
property. It is not a string. Same with createdBy
, updatedBy
and so on.
hi. apologies for only getting back now. that is exactly what i am trying to say. the parser is not parsing mongoose objects correctly.
the below record is producing an error when parsing xml
{ address: { city: {}, street: 'that is a thing hey', }, _id: new ObjectId("626126118baaa602b96f15fa"), type: 'SYSTEM', value: { API_KEY: '0702730074msh0fe47ec6bd19b1e457e' }, deleted: true, createdBy: new ObjectId("6234d37fe1f8f7e7d8334b61"), updatedBy: new ObjectId("6234d37fe1f8f7e7d8334b61"), createdAt: 2022-04-21T09:38:25.011Z, updatedAt: 2022-04-21T09:38:25.011Z, name: 'Public Holiday API Key 2' }
TypeError: textValue.replace is not a function at Builder.replaceEntitiesValue (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:224:29) at Builder.buildTextValNode (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:202:22) at Builder.j2x (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:112:23) at Builder.processTextOrObjNode (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:157:23) at Builder.j2x (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:141:21) at Builder.processTextOrObjNode (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:157:23) at Builder.j2x (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:141:21) at Builder.processTextOrObjNode (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:157:23) at Builder.j2x (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:127:23) at Builder.build (${root}/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js:85:17)
when checking the output for textValue it seems to be a function. hence the error.