I’m verry new at JSP and Java. Installed Tomcat and the Telephone example from Tamino. All this works fine. What I really would like to display is only the XML starttags and not the content. F.ex. a pulldownlist with available XML tags. Someone who can help? We need to know whats possible so we can decide wich programming language we will use for accessing Tamino. Thanks in advance!
TaminoResult myTR = myTC.query(“Telephone [LoginName~="W*"]”); /* cast for enumeration / Enumeration e = myTR;
if ( !e.hasMoreElements() ) out.println("Query :Telephone[LoginName~="W"] No elements found !" ); else while( e.hasMoreElements() ){ Element el=(Element)e.nextElement(); for ( int x = 0; x < 10; x++ ) { String name = el.getElementsByTagName(“*”).item(x).getNodeName(); out.println(name); } }
getElementsByTagName() returns a NodeList object, and the NodeList has a getLength() method to tell you how many Nodes it contains.
So if you use two steps:
Element el=(Element)e.nextElement(); NodeList myList = el.getElementsByTagName(*); for ( int x = 0; x < myList.getLength(); x++ ) { String name = myList.item(x).getNodeName(); out.println(name); } } it should work.
[This message was edited by Bill Leeney on 07 Dec 2001 at 15:07.]
It works, thanks. By the way: ther’re quotes needed: NodeList myList = el.getElementsByTagName(); should be NodeList myList = el.getElementsByTagName("");