Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void search()
- {
- NodeList nl = doc.getElementsByTagName("LKW");
- int gewicht;
- for(int i = 0; i < nl.getLength(); i++)
- {
- gewicht = Integer.parseInt(nl.item(i).getAttributes().getNamedItem("Zuladung").getNodeValue());
- if(gewicht >= 8000)
- {
- System.out.println(nl.item(i).getChildNodes().item(1).getAttributes().getNamedItem("Leistung").getNodeValue());
- }
- }
- }
- public void search2()
- {
- NodeList nl = doc.getElementsByTagName("LKW");
- int gewicht;
- Element lkw, motor;
- for(int i = 0; i < nl.getLength(); i++)
- {
- lkw = (Element) nl.item(i);
- gewicht = Integer.parseInt(lkw.getAttribute("Zuladung"));
- if(gewicht >= 8000)
- {
- motor = (Element) lkw.getElementsByTagName("Motor").item(0);
- System.out.println(motor.getAttribute("Leistung"));
- }
- }
- }
Add Comment
Please, Sign In to add comment