startElement(stream, "nodes");
for (String nodeId : graphSpells.getNodes()) {
startElement(stream, "node");
stream.writeAttribute("id", nodeId);
CumulativeAttributes attr = graphSpells
.getNodeAttributes(nodeId);
Object label = attr.getAny("label");
if (label != null)
stream.writeAttribute("label", label.toString());
CumulativeSpells spells = graphSpells.getNodeSpells(nodeId);
if (!spells.isEternal()) {
startElement(stream, "spells");
for (int i = 0; i < spells.getSpellCount(); i++) {
Spell s = spells.getSpell(i);
startElement(stream, "spell");
putSpellAttributes(s);
endElement(stream, true);
}
endElement(stream, false);
}
if (attr.getAttributesCount() > 0) {
startElement(stream, "attvalues");
nodeAttributes.push(stream, nodeId, graphSpells);
endElement(stream, false);
}
endElement(stream,
spells.isEternal() && attr.getAttributesCount() == 0);
}
endElement(stream, false);
startElement(stream, "edges");
for (String edgeId : graphSpells.getEdges()) {
startElement(stream, "edge");
GraphSpells.EdgeData data = graphSpells.getEdgeData(edgeId);
stream.writeAttribute("id", edgeId);
stream.writeAttribute("source", data.getSource());
stream.writeAttribute("target", data.getTarget());
CumulativeAttributes attr = graphSpells
.getEdgeAttributes(edgeId);
CumulativeSpells spells = graphSpells.getEdgeSpells(edgeId);
if (!spells.isEternal()) {
startElement(stream, "spells");
for (int i = 0; i < spells.getSpellCount(); i++) {
Spell s = spells.getSpell(i);
startElement(stream, "spell");
putSpellAttributes(s);
endElement(stream, true);
}
endElement(stream, false);
}
if (attr.getAttributesCount() > 0) {
startElement(stream, "attvalues");
edgeAttributes.push(stream, edgeId, graphSpells);
endElement(stream, false);
}
endElement(stream,
spells.isEternal() && attr.getAttributesCount() == 0);
}
endElement(stream, false);
endElement(stream, false);
} catch (XMLStreamException e1) {