Can't read some attributes with SAX
- by akappa
Hi all,
I'm trying to parse that document with SAX:
<scxml version="1.0" initialstate="start" name="calc">
<datamodel>
<data id="expr" expr="0" />
<data id="res" expr="0" />
</datamodel>
<state id="start">
<transition event="OPER" target="opEntered" />
<transition event="DIGIT" target="operand" />
</state>
<state id="operand">
<transition event="OPER" target="opEntered" />
<transition event="DIGIT" />
</state>
</scxml>
I read all the attributes well, except "initialstate" and "name"...
I get the attributes with the startElement handler, but the size of the attribute list for scxml is zero. Why? How I can overcome that problem?
Edit:
public void startElement(String uri, String localName, String qName, Attributes attributes){
System.out.println(attributes.getValue("initialstate"));
System.out.println(attributes.getValue("name"));
}
that, when parsing the first tag, doesn't work (prints "null" two times). In fact,
attributes.getLength();
evaluates to zero.
Thanks