0

I have been trying to extract the information from this file for the past couple of hours and have run out of options.

http://www.nationalbanken.dk/dndk/valuta.nsf/valuta-hist.xml

Currently I have the information stored as a string in a Java servlet.

When I try to send it as a response to an AJAX request, I can't seem to extract any of the attributes through jQuery (mainly the time, currency, etc.)

I don't have a whole lot of experience with XML, actually none, so after trying various methods here on StackOverflow I have come to the conclusion that I simply can't find anything that'll work for me.

$("#btn").click(function() {
    $.ajax({
        url: "AjaxController?command=currency",
        cache: false,
        dataType: "xml",
        success: processXML
    });
});

This is my AJAX call to the servlet, in return it gives back the file linked above loaded into a string, which then needs to be processed and extracted by the jQuery function "processXML".

informatik01
  • 16,038
  • 10
  • 74
  • 104
Dekez
  • 31
  • 2
  • 1
    So what is your question? How to parse XML-data in jQUery function? Or what? – Maksim Dec 02 '13 at 13:44
  • You want to parse/access xml using jquery? or you are getting problem with response? – Asif Bhutto Dec 02 '13 at 13:49
  • The problem I have is that because of the way the xml is formatted, I cant seem to gain access to the attributes and their values. I can get the "Aktuelle Valutakurser" and "National Banken" things that are in plain text but everything else just comes out as undefined everytime I try to do anything with it. If I just do alert(data) it will show the entire xml file but I am not able to do anything with it. – Dekez Dec 02 '13 at 13:53
  • I think that this could be useful http://stackoverflow.com/questions/373833/best-xml-parser-for-java – Jordin Dec 02 '13 at 23:48
  • One of the solutions might be the this: [How to Parse XML File using XPath in Java](http://viralpatel.net/blogs/java-xml-xpath-tutorial-parse-xml/) – informatik01 Dec 02 '13 at 23:52

0 Answers0