I am trying to store the application preferences in an xml file. I am aiming for a structure like this for a JTable for which users can change the list of columns that are displayable.
<table_test> <columns> <column name ="col 1" width ="100"> <column name = "col 2" width ="150"> </columns> </table_test>
- but when I read the file using a DOM parser, my columns element contains only the 'col 2' entry. I can understand that this is happening because the child elements have the same name 'column'. How can I get around this problem. The columns node can have different number of entries at different point of time.
Originally posted by Dalia Sultana: when I read the file using a DOM parser, my columns element contains only the 'col 2' entry. I can understand that this is happening because the child elements have the same name 'column'.
No, you understand incorrectly. The DOM parser will produce a structure that contains all of the "column" elements. It's then up to you to write code that extracts them all, and I expect you didn't do that correctly.
So have another look at your code. Post it here if you are still having problems extracting the data in the way you want. [ July 31, 2007: Message edited by: Paul Clapham ]