Esempio n. 1
0
 private XMLElement writeStorable(DOMStorable o) throws IOException {
   String tagName = factory.getName(o);
   if (tagName == null) throw new IllegalArgumentException("no tag name for:" + o);
   openElement(tagName);
   XMLElement element = current;
   if (objectids.containsKey(o)) {
     addAttribute("ref", (String) objectids.get(o));
   } else {
     String id = Integer.toString(objectids.size(), 16);
     objectids.put(o, id);
     addAttribute("id", id);
     o.write(this);
   }
   closeElement();
   return element;
 }
 /** Adds a DOMStorable prototype to the DOMFactory. */
 public void addStorable(String name, DOMStorable prototype) {
   nameToPrototypeMap.put(name, prototype);
   classToNameMap.put(prototype.getClass(), name);
 }