try {
Document document = XMLParser.parse(xml);
Element root = document.getDocumentElement();
// model
Builder builder = new Builder();
dfsElement(builder, DOMUtils.getFirstChildElement(root));
// dialog
Dialog dialog = new Dialog(new QName(root.getNamespaceURI(), root.getAttribute("id")), builder.build());
return dialog;
} catch (RuntimeException e) {
Window.alert("Faile to parse XML: "+e.getMessage());
throw e;