use of doc.attributes.MathObjectAttribute in project OpenNotebook by jaltekruse.
the class OldReader method readAttribute.
public void readAttribute(String uri, String name, String qName, Attributes atts) {
MathObjectAttribute mAtt = null;
boolean justAddedAttribute = false;
if (qName.equals("BooleanAttribute")) {
mAtt = new BooleanAttribute(atts.getValue(NAME));
justAddedAttribute = true;
} else if (qName.equals("DoubleAttribute")) {
mAtt = new DoubleAttribute(atts.getValue(NAME));
justAddedAttribute = true;
} else if (qName.equals("GridPointAttribute")) {
mAtt = new GridPointAttribute(atts.getValue(NAME));
justAddedAttribute = true;
} else if (qName.equals("IntegerAttribute")) {
mAtt = new IntegerAttribute(atts.getValue(NAME));
justAddedAttribute = true;
} else if (qName.equals("StringAttribute")) {
mAtt = new StringAttribute(atts.getValue(NAME));
justAddedAttribute = true;
} else {
if (mObj == group) {
return;
}
if (DEBUG) {
System.out.println("bad attribute found! " + qName);
}
}
if (justAddedAttribute) {
try {
mAtt.setValueWithString(atts.getValue(VALUE));
mObj.addAttribute(mAtt);
mObj.setAttributeValue(mAtt.getName(), mAtt.getValue());
} catch (AttributeException e) {
if (DEBUG) {
System.out.println(e.getMessage());
}
hadAttributeError = true;
attributeNameInError = atts.getValue(NAME);
attributeValueInError = atts.getValue(VALUE);
objectWithError = mObj.getClass().getSimpleName();
justAddedAttribute = false;
return;
}
} else {
for (int i = 0; i < atts.getLength(); i++) {
if (DEBUG) {
System.out.println(atts.getValue(i).toString());
}
}
hadAttributeError = true;
attributeNameInError = atts.getValue(NAME);
attributeValueInError = atts.getValue(VALUE);
objectWithError = mObj.getClass().getSimpleName();
justAddedAttribute = false;
return;
}
}
Aggregations