code: public void addNamespace( String prefix, String uri, String elementName ) {
        if( StringUtils.isBlank( uri ) ){
           return;
        }
        if( prefix == null ){
           prefix = "";
        }
        if( StringUtils.isBlank( elementName ) ){
           rootNamespace.put( prefix.trim(), uri.trim() );
        }else{
           Map nameSpaces = (Map) namespacesPerElement.get( elementName );
           if( nameSpaces == null ){
              nameSpaces = new TreeMap();
              namespacesPerElement.put( elementName, nameSpaces );
           }
           nameSpaces.put( prefix, uri );
        }
     }
docs: Adds a namespace declaration to an element.<br>
  If the elementName param is null or blank, the namespace declaration will
  be added to the root element.
  
  @param prefix namespace prefix
  @param uri namespace uri
  @param elementName name of target element