• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve data from childs in XML

Isaac Ferguson
Ranch Hand
Posts: 963
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In order to access to this data in my .xml


I use the method:

company = companyData.item(0);
if (company.getNodeType() == Node.ELEMENT_NODE) {

Element elemento = (Element) company;
String com = getTagValue("name", elemento);
if (com.equals(companyName)) {

this.setDimension(getTagValue("dimension", elemento));


// Return nodo with data
return company;


public String getTagValue(String tag, Element elemento) {

NodeList lista = elemento.getElementsByTagName(tag).item(0)

Node valor = (Node) lista.item(0);

return valor.getNodeValue();


I need retrieve values store in the tags "CityName" and "browser". What way could I get them?

Many Thanks,

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic