public void updateStyleElement(Document document,Element style){
  StringBuilder buf=new StringBuilder();
  serialize(buf);
  Text cont=document.createTextNode(buf.toString());
  while (style.hasChildNodes()) {
    style.removeChild(style.getFirstChild());
  }
  style.appendChild(cont);
}

public void updateStyleElement ( Document document , Element style ) { StringBuilder buf = new StringBuilder ( ) ; serialize ( buf ) ; Text cont = document . createTextNode ( buf . toString ( ) ) ; while ( style . hasChildNodes ( ) ) { style . removeChild ( style . getFirstChild ( ) ) ; } style . appendChild ( cont ) ; }
update the text contents of an existing style element .
