Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda