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