Help dealing with nodes

Hi!

I'm trying to parse an XML document in order to store the various elements into Oracle DB tables.

In the document, I have a node like...

<ElementList>

<Element elem_code="AA">

<Name>A Name</Name>

... etc

In Java, I write something like...

NodeList listOfElements = doc.getElementsByTagName("Element");

int totalElements = listOfElements.getLength();

...and totalElements correctly contains the number of "Element" tags that are in the document. I'm trying to get the "elem_code" (in this case "AA"), but I don't know how. Please help this newbie.

BTW, I'm following this example: http://www.developerfusion.co.uk/show/2064/

Thx!!!

[729 byte] By [delphosbeana] at [2007-11-27 11:50:01]
# 1

Once you get an Element (as already shown in that example) you can use its getAttribute() method. You will get more answers of this type by looking in the API documentation for the class. If you haven't already downloaded the Java API documentation then I recommend you do that. Or you can look at it on-line.

http://java.sun.com/j2se/1.5.0/docs/api/

DrClapa at 2007-7-29 18:28:44 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Thanks Dr!

delphosbeana at 2007-7-29 18:28:44 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...