I need help with dividing these lines of code and putting them into methods:
url = new URL(URL_SOURCE);
con = url.openConnection();
is = con.getInputStream();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(is);
doc.getDocumentElement().normalize();
NodeList nList = doc.getElementsByTagName("pozycja");
I divied it into:
public URLConnection openConnectionOfGivenURL(String givenURL) throws IOException {
URL url = new URL(givenURL);
return url.openConnection();
}
I dont know what should I do with the rest. Should I name it with getDOM
?