aspose file tools
The moose likes Java in General and the fly likes Parsing nested elements with DOM Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Parsing nested elements with DOM" Watch "Parsing nested elements with DOM" New topic
Author

Parsing nested elements with DOM

Vito Czz
Greenhorn

Joined: Mar 21, 2011
Posts: 6
Hi everybody, i'm trying to parse an xml file like this:


I need to save values of the elements into some variables, to access and print them... I've started writing the java code:


Now, the problem is: how can I access the elements under <pezzatura> tag and associate them with the prodotto element I've created?
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

element.getElementsByTagName("vaso") should work if I'm not mistaken. Then just add the value to your prodotto.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Parsing nested elements with DOM
 
Similar Threads
mappedBy reference an unknown target entity property:
WS error in saving objects/printing results
@PostConstruct never called on SessionScoped Managed Bean
extraneous characters getting introduced in XML
Multiple level logic:iterate