Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
Reading xml file with a non-common structure

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:

enter image description here

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.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda