Hi stackers,
I would like to parse an XML which sometimes have an attribute, sometimes not:
<tagName constructor="AdvancedCriteria" />
or
<tagName />
I added a rule to flag the attribute presence:
digester.addRule("*/tagName", new Rule()
{
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception
{
advCrit = attributes.getIndex("constructor") != -1;
}
}
But it is not the correct way to do such a task. Do you have any clue?