public static String makeSimpleDoc(String... fieldsAndValues){
  try {
    StringWriter w=new StringWriter();
    w.append("<doc>");
    for (int i=0; i < fieldsAndValues.length; i+=2) {
      XML.writeXML(w,"field",fieldsAndValues[i + 1],"name",fieldsAndValues[i]);
    }
    w.append("</doc>");
    return w.toString();
  }
 catch (  IOException e) {
    throw new RuntimeException("this should never happen with a StringWriter",e);
  }
}

public static String makeSimpleDoc ( String ... fieldsAndValues ) { try { StringWriter w = new StringWriter ( ) ; w . append ( "<doc>" ) ; for ( int i = 0 ; i < fieldsAndValues . length ; i += 2 ) { XML . writeXML ( w , "field" , fieldsAndValues [ i + 1 ] , "name" , fieldsAndValues [ i ] ) ; } w . append ( "</doc>" ) ; return w . toString ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "this should never happen with a StringWriter" , e ) ; } }
a helper that creates an xml & lt ; doc & gt ; containing all of the fields and values specified
