Searching for attributes
843834Jun 15 2001 — edited Jun 15 2001I'm using SaxParser and trying to identify an attibute, the line in the xml document looks like this:
<question id="q001" type="single_answer" status="enable">
In my parser I've tried to locate the "type" attribute
with:
public void startElement (String uri, String name,
String qName, Attributes atts)
{
//System.out.println("Start element: {" + uri + "}" + name);
////////////////////////////////////////////////////////////////////////////////////////////////////
String question_type = atts.getType("id");
System.out.println(question_type);
if( name.equals("question_text")){
XMLquestion_text_counter++;
System.out.println(XMLquestion_text_counter);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
}
Keeps coming back null
Can anyone shed some light on why?
Learning this as I go.
Thanks
Jim