Attr attr = element.getAttributeNodeNS(namespaceURI, localName);
final String s = attr == null ? defaultValue : attr.getValue();
final float[] numbers = new float[4];
NumberListParser p = new NumberListParser();
p.setNumberListHandler(new DefaultNumberListHandler() {
protected int count;
public void endNumberList() {
if (count != 4) {
throw new LiveAttributeException
(element, localName,
LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
s);
}
}
public void numberValue(float v) throws ParseException {
if (count < 4) {
numbers[count] = v;
}
if (v < 0 && (count == 2 || count == 3)) {
throw new LiveAttributeException
(element, localName,
LiveAttributeException.ERR_ATTRIBUTE_MALFORMED,
s);
}
count++;
}
});
p.parse(s);
x = numbers[0];
y = numbers[1];
w = numbers[2];
h = numbers[3];