Element (Xpp3Dom xpp) { Element result; try { result = new Element(xpp.getName()); } catch (IllegalNameException e) { MavenServerGlobals.getLogger().info(e); return null; } Xpp3Dom[] children = xpp.getChildren(); if (children == null || children.length == 0) { result.setText(xpp.getValue()); } else { for (Xpp3Dom each : children) { Element child = xppToElement(each); if (child != null) result.addContent(child); } } return result; }