This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes parse siblings in DOM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parse siblings in DOM" Watch "parse siblings in DOM" New topic

parse siblings in DOM

S lakum

Joined: Jun 14, 2002
Posts: 9
I went through all the possible help code from the net which tells me how to access the value/child of a tag.
But what I need is to access the column values for each table. There are several tables in this xml file. So, I search for the table name through getElementsByTagName(), then I need to parse for the column-names. I'm not able to make it work with getNextSibling().
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
The method getElementsByTagName() returns a node list.
You can iterate through it like -

It returns -
Inside Text: camp_id
Inside Text: ccr_id
Inside Text: record_id
Inside Text: record_num
Isn't it what you want? Why do you need to use the getNextSibling() method?

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
S lakum

Joined: Jun 14, 2002
Posts: 9
Hey Dan,
Thanx for the response.
What I'm trying to do is to read column-names from various tables. So, given a table-name, I just want it's column-names. That's why I'm searching for tagname 'table-name'
I agree. Here's the link:
subject: parse siblings in DOM
Similar Threads
problem simply stated
hbm.xml file does an update instead of an insert- Helppppp
Hibernate one-to-one mapping with foreign key
Mapping document query
Invalid Mapping Exception while inserting data through hibernate