lundi 15 juillet 2019

Get value from xml file www.bnr.ro java

The code show this error "SAXParseException: Premature end of file. " when trying to read from this xml file http://www.bnr.ro/nbrfxrates.xml.

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(new URL("http://www.bnr.ro/nbrfxrates.xml").openStream());
    if(doc!=null){
        System.out.print("Not null");
    } else {
        System.out.print("Null");
    }

Aucun commentaire:

Enregistrer un commentaire