Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void fetchBuyingAndSellingRate(String line, String currency) throws ParserConfigurationException, SAXException, IOException {
- if (line == null) {
- return;
- }
- String URL_SOURCE = "http://www.nbp.pl/kursy/xml/" + line + ".xml";
- Document doc = dataFetcher.getXML(URL_SOURCE);
- NodeList nList = doc.getElementsByTagName("pozycja");
- for (int temp = 0; temp < nList.getLength(); temp++) {
- Node nNode = nList.item(temp);
- if (nNode.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) nNode;
- if (eElement.getElementsByTagName(CURRENCY_CODE).item(0).getTextContent().equals(currency)) {
- buyingRate = getFieldFromDOM(eElement, BUY_RATE_TAG);
- sellingRate = getFieldFromDOM(eElement, SELL_RATE_TAG);
- }
- }
- }
- sumOfBuyingRate += buyingRate;
- sellingRates.add(sellingRate);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement