for (Element circElt : XmlIterator.forChildElements(elt, "circuit")) {
String name = circElt.getAttribute("name");
if (name == null || name.equals("")) {
addError(Strings.get("circNameMissingError"), "C??");
}
CircuitData circData = new CircuitData(circElt, new Circuit(name));
file.addCircuit(circData.circuit);
circData.knownComponents = loadKnownComponents(circElt);
for (Element appearElt : XmlIterator.forChildElements(circElt, "appear")) {
loadAppearance(appearElt, circData, name + ".appear");
}
circuitsData.add(circData);
}
// third, process the other child elements
for (Element sub_elt : XmlIterator.forChildElements(elt)) {
String name = sub_elt.getTagName();
if (name.equals("circuit") || name.equals("lib")) {
; // Nothing to do: Done earlier.
} else if (name.equals("options")) {
try {
initAttributeSet(sub_elt, file.getOptions().getAttributeSet(), null);
} catch (XmlReaderException e) {
addErrors(e, "options");
}
} else if (name.equals("mappings")) {
initMouseMappings(sub_elt);
} else if (name.equals("toolbar")) {
initToolbarData(sub_elt);
} else if (name.equals("main")) {
String main = sub_elt.getAttribute("name");
Circuit circ = file.getCircuit(main);
if (circ != null) {
file.setMainCircuit(circ);
}
} else if (name.equals("message")) {
file.addMessage(sub_elt.getAttribute("value"));