code: protected Element findAndReplaceXpp3DOM(Counter counter, Element parent, String name, Xpp3Dom dom)
     {
        boolean shouldExist = (dom != null) && ((dom.getChildCount() > 0) || (dom.getValue() != null));
        Element element = updateElement(counter, parent, name, shouldExist);
        if (shouldExist)
        {
           replaceXpp3DOM(element, dom, new Counter(counter.getDepth() + 1));
        }
        return element;
     }
docs: Method findAndReplaceXpp3DOM.
  
  @param counter
  @param dom
  @param name
  @param parent