Separating XML contents to create lists
I want to separate the XML contents so that I can create lists. How do I create a dropdown list based on the XML contents?
[143 byte] By [
tnr009] at [2007-9-26 2:02:21]

I know how to extract XML out using XSLT servlet, but, the output is full of tags. What I want is sort of list or I can create navigation with.
If I understand you right then you might try something like this:
Say your XML doc was:
<books>
<book>book 1</book>
<book>book 2</book>
<book>book 3</book>
<book>book 4</book>
</books>
just get the NodeList of <book> nodes, iterate through them, building your JList as you go. Did that help ?
Yes, that's correct! I understand what you're saying. Do you mind providing an example of how to get the NodeList of this <book> nodes, iterate through them and build the JList?Thanks.
You just follow mtndood's instruction and instead of creating a Vector, you use JList's ListModel to add your elements to your JList.see http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#mutable for further help.Good luck.
lk555 at 2007-6-29 8:43:44 >

Hi,Thanks for the URL. But, in the example, it shows individual strings. What I want is to extract values from a file which may contain 10,000 entries. Please let me know how would I do that.TIA,