public static void createSingleNode(String key,String val,StringBuffer xml) throws ParserConfigurationException {
  DocumentBuilder db=XMLUtils.getSafeDocumentBuilder(false);
  Document doc=db.newDocument();
  Element item=doc.createElement(key);
  item.appendChild(doc.createTextNode(val));
  xml.append(item.toString());
}

public static void createSingleNode ( String key , String val , StringBuffer xml ) throws ParserConfigurationException { DocumentBuilder db = XMLUtils . getSafeDocumentBuilder ( false ) ; Document doc = db . newDocument ( ) ; Element item = doc . createElement ( key ) ; item . appendChild ( doc . createTextNode ( val ) ) ; xml . append ( item . toString ( ) ) ; }
creates a single xml node and appends that node to the input xml construct .
