code: protected Element findAndReplaceSimpleElement(Counter counter, Element parent, String name, String text,
              String defaultValue)
     {
        if ((defaultValue != null) && (text != null) && defaultValue.equals(text))
        {
           Element element = parent.getChild(name, parent.getNamespace());
           // if exist and is default value or if doesn't exist.. just keep the
           // way it is..
           if (((element != null) && defaultValue.equals(element.getText())) || (element == null))
           {
              return element;
           }
        }
  
        boolean shouldExist = (text != null) && (text.trim().length() > 0);
        Element element = updateElement(counter, parent, name, shouldExist);
        if (shouldExist)
        {
           element.setText(text);
        }
        return element;
     }
docs: Method findAndReplaceSimpleElement.
  
  @param counter
  @param defaultValue
  @param text
  @param name
  @param parent