no soy capaz de analizar un xml sencillisimo. me podeis ayudar?

[email protected]
Newsgroups gmane.comp.java.javaspain
Message-ID <[email protected]>
Hola
tengo unos xmls sencillisimos del tipo:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<REGISTROS>
<REGISTRO>
<ID>1</ID>
<APLIC>primera</APLIC>
</REGISTRO>
<REGISTRO>
<ID>2</ID>
<APLIC>segunda</APLIC>
</REGISTRO>
</REGISTROS>Estoy intentando analziarlo y doy pasos pero no consigo "en la
misma vuenta" tomar lo que hay en cada nodo REGISTRO.
es decir, hago lo sigueinte:

NodeList nl = doc.getDocumentElement().getElementsByTagName("APLIC");
if (nl != null && nl.getLength() > 0) {
for (int i=0; i < nl.getLength(); i++) {
Element e = (Element)nl.item(i);
if (e.getFirstChild().getNodeValue()!= null) {
System.out.println("//------>: " + e.getFirstChild().getNodeValue());
}
}
}

Con esto imprimo el valor de APLIC pero al lado, en la misma vuenta,
quisiera tomar el valor del campo ID cosa que no peudo o no logro.
Mi intencion es por cada nodo REGISTRO llenar un objeto (bean) que tiene
dos propiedades, id y aplic par air añadiendolo a aun arraylist en el cual
van estos objetos.

Me podeis ayudar por favor?

gracias
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.