D
D
Danil2020-11-30 06:04:56
Java
Danil, 2020-11-30 06:04:56

How to parse XML in Java?

It is necessary to obtain a list of current currencies and their rates from the CBRF website, and write them to the database ( www.cbr.ru/scripts/XML_daily.asp ).
There is an understanding that you need to parse xml into an array and already enter the array into the database (correct if something is wrong) The
question is how to parse an xml file from the Internet into
java

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2020-11-30
@Danicimo

Good afternoon!

am I correct in my opinion that you need to add xml to the array and the array is already in the database

How else do you imagine it? First serialize the xml into pojos and then add each pojo to some collection or array. Well and save in a DB.
If you take the minimum, then read about DOM Parser in Java for parsing. You can also explore SAX Parser further. Or you can include the library.
Well, to work with the database, you need a library. At least jdbc. And so you can look towards ORM (hibernate, eclipselink, ormlite, etc.)
I wrote something similar, but without saving it to the database.
Here is the link to the git:
https://github.com/azerphoenix/cbar-currency

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question