S
S
Shurik2020-05-15 16:42:19
JavaScript
Shurik, 2020-05-15 16:42:19

How to parse data from xml file into javascript?

Hello. The task was to fill in the form input fields from the xml file loaded into the input (or possibly json). That is, the file will not be from the server, but local.
The question is, is it possible to read it and then extract everything from the xml format into a js object, and then insert it into the form fields?
If yes, then I will be grateful for the information about the sequence of actions and the nuances that you may encounter during implementation. Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Polos, 2020-05-15
@svisch

In order to read the file from the locale, you can use To read the file itself, you can study such a snippet and modify it for yourself, instead of assigning it to innerHTML - just remember it in a variable, for example fileContent. For parsing XML: here For JSON: JSON.parse( fileContent ); <input type="file">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question