@Override public void unmarshal(Element root) throws ParseException { // attributes NamedNodeMap attrs = root.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { Attr attr = (Attr) attrs.item(i); String name = attr.getName(); String value = attr.getNodeValue(); if (name.equals("version")) { version = value; break; } } // elements ArrayList<Element> children = (ArrayList<Element>) DOMHelp.getChildElements(root); for (Element child : children) { String localName = child.getLocalName(); if (localName.equals("event")) { PremisEvent ev = new PremisEvent(); ev.unmarshal(child); getEvent().add(ev); } else if (localName.equals("object")) { String typeString = child.getAttributeNS(NS.XSI.ns(), "type").replaceAll("^\\w+:", ""); PremisObjectType type = PremisObject.PremisObjectType.valueOf(typeString); if (type == null) { continue; } PremisObject obj = new PremisObject(type); obj.unmarshal(child); getObject().add(obj); } else if (localName.equals("agent")) { PremisAgent agent = new PremisAgent(); agent.unmarshal(child); getAgent().add(agent); } else if (localName.equals("rights")) { PremisRights r = new PremisRights(); r.unmarshal(child); getRights().add(r); } } }