0

I want to download the value of selected tag from some site. The only way i know is is to download whole XML and then get the value.

My Question is: Can i get the value without downloading whole XML?

For example: I have this site:

http://api.nbp.pl/api/exchangerates/tables/a/?format=xml

And i only want to download the value of tag "EffectiveDate". I know i can download whole XML then get it but why should I if I want get only one value.

Is there any way to do it in Java?

Mike Quoro
  • 141
  • 1
  • 7
  • 1
    try this post: [http://stackoverflow.com/questions/2310139/how-to-read-xml-response-from-a-url-in-java](http://stackoverflow.com/questions/2310139/how-to-read-xml-response-from-a-url-in-java) –  Jul 15 '16 at 09:55

2 Answers2

1

If you are looking for converting the data given in some XML format to convert it to Java objects then you can use those values as you need . There is java marshalling and unmarshalling of XML to Java object would help you to do it.

Please refer to the below link for example.. http://www.javatpoint.com/jaxb-unmarshalling-example

Alok Ray
  • 88
  • 6
1

It's not possible to get those values without downloading whole xml. What if at the end of XML there are tags which are matching your needs? On other hand if you need only specific values - maybe it's worth to update backend to return values specified by some selector?

Igor Konoplyanko
  • 9,176
  • 6
  • 57
  • 100