20 package net.sf.gridarta.model.spells;
25 import nu.xom.Document;
26 import nu.xom.Element;
27 import org.apache.log4j.Category;
28 import org.apache.log4j.Logger;
29 import org.jetbrains.annotations.NotNull;
57 final Element root = document.getRootElement();
58 if (root ==
null || !root.getLocalName().equals(
"spells")) {
63 for (
final Element spellElem :
new ElementsIterable(root.getChildElements(
"spell"))) {
64 if (spellElem.getAttribute(
"id") ==
null) {
66 }
else if (spellElem.getAttribute(
"name") ==
null) {
71 spells.add(
new NumberSpell(spellElem.getAttribute(
"name").getValue().trim(), Integer.parseInt(spellElem.getAttribute(
"id").getValue())));
73 }
catch (
final NumberFormatException ignored) {
80 if (
LOG.isInfoEnabled()) {
81 LOG.info(
"Loaded " + numSpells +
" defined spells.");