Given this XML snippet
Gambardella, Matthew
public void startElement(String strNamespaceURI, String strLocalName,
String strQName, Attributes al) throws SAXException {
if(strLocalName.equalsIgnoreCase("HIT"))
{
String output1 = al.getValue("NAME");
//this will work but how can we parse if NAME="abc" only ?
}
}
That's the usual way to do it with SAX.
Just beware that characters()
may be called more than once per tag. See this question for more info. Here is a complete example.
Otherwise you could give a try to StAX.