hi i have an xml file that have a weird structure. here is an example of how it looks.
store: 1234 order: 123123 po:123123 mode: 1231231
date: 1231231 req date: 1231231 status: A wshe: 12312
then is gives me a detailed list of the items that comes with the previously mentiones header information on the XML like this:
after that comes the information.
right now i'm using xlsx with nodejs to read the file. here is my code:
function xmlOrdenEntrega(excels) {
const file = reader.readFile(`${excels}`, {cellText:false, cellDates:true});
let data = []
const sheets = file.SheetNames
const sheets1 = file.Sheets
for (let i = 0 ; i < sheets.length; i++){
const temp = reader.utils.sheet_to_json(
file.Sheets[file.SheetNames[i]] ,{skipHeader: true, origin: "A5",dateNF: 'mm/dd/yyyy',blankrows: true, raw: false,})
temp.forEach((res) => {
data.push(res)
})
}
return data;
};
this function returnsme the correct information during the first iteration of the xml, this xml is composed of various iterations of the same structure. a header and a detail section.
after the fist segement is reader i normaly resive the fist line as follow:
__White_:store
__White_1:1234
like that for the fisrt section of the headder
after for the detaled section is comes in the way i would spect to all good there. but the during the second iteration of the reading function is starts to fail and it comes with the data as follow:
store:: date:
1234: 1231231
order:: req:
it's like it's takin both rows of the xml and pairing them, but i don't know why it's happening when in the fist iteration it works just fine. if someone know what is happening and what i am doing wrong, or if it is a limitation of the node-xlsx library plase tell me.