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

141
Visualizações
How to get XML file content in React?

I am trying to read XML-files in my client app.

  const handleFiles = files => {
        console.log(files[0])

}

    <ReactFileReader multipleFiles={false} fileTypes={[".xml"]} handleFiles={handleFiles}>
                <button className='btn'>Upload</button>
            </ReactFileReader>

This is the output:

File {name: 'test.xml', lastModified: 1644272268000, lastModifiedDate: Tue Feb 08 2022 00:17:48 GMT+0200 (Eastern European Standard Time), webkitRelativePath: '', size: 58152550, …}
lastModified: 1644272268000
lastModifiedDate: Tue Feb 08 2022 00:17:48 GMT+0200 (Eastern European Standard Time)
[[Prototype]]: Object
name: "F17_LeaderSFR_HebergeBYT_AuditOMC_20220208_0005.xml"
size: 58152550
type: "text/xml"
webkitRelativePath: ""
[[Prototype]]: File

When I am trying to parse the XML file to string

 var xml = new XMLParser().parseFromString(files[0], "text/xml");  

I get the following error

Uncaught TypeError: (intermediate value)(intermediate value).replace is not a function
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