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
Post a Comment