java - I am trying to convert a string to efficient xml using nagasena example but i get a runtime error -


private static void encode(string sourcefile) throws filenotfoundexception,       ioexception, exioptionsexception, transmogrifierexception { string scurrentline=null; stringbuilder sb = new stringbuilder(); try (bufferedreader br = new bufferedreader(new filereader(sourcefile))){  while ((scurrentline = br.readline()) != null) { sb.append(scurrentline); }  } string sb1= sb.tostring();  system.out.println("xml string:"+sb1+"\n");  outputstream out =null; //this code nagasena  grammarcache grammarcache; transmogrifier transmogrifier = new transmogrifier(); grammarcache = new grammarcache(grammaroptions.default_options); transmogrifier.setgrammarcache(grammarcache); transmogrifier.setoutputstream(out); //passing string input     transmogrifier.encode(new inputsource(sb1)); system.out.println("check2 : string exi conversion"+ out +"\n"); 


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -