public virtual string GetXml() { StringBuilder xmlOut = new StringBuilder(); if (lexRecordObjs_ != null) { xmlOut.Append(LexRecord.GetXmlHeader()); xmlOut.Append(GlobalVars.LS_STR); xmlOut.Append(LexRecord.GetXmlRootBeginTag()); xmlOut.Append(GlobalVars.LS_STR); for (int i = 0; i < lexRecordObjs_.Count; i++) { LexRecord temp = (LexRecord)lexRecordObjs_[i]; xmlOut.Append(temp.GetXml(1)); } xmlOut.Append(LexRecord.GetXmlRootEndTag()); xmlOut.Append(GlobalVars.LS_STR); } return(xmlOut.ToString()); }
public static void Main(string[] args) { string bat = "{base=bat\nentry=E0012112\n\tcat=noun\n\tvariants=reg\nsignature=vanni\n}"; string molt = "{base=molt\nspelling_variant=moult\nentry=E0040723\n\tcat=noun\n\tvariants=reg\n\tacronym_of=test123\n\tabbreviation_of=test456\n\tacronym_of=test789\nsignature=vanni\n}\n{base=molt\nspelling_variant=moult\nentry=E0040724\n\tcat=verb\n\tvariants=reg\n\tintran\n\ttran=np\n\tnominalization=molting|noun|E0412675\nsignature=vanni\n}"; if (args.Length == 0) { try { LexRecord lexRecord; List <LexRecord> lexRecords = ToJavaObjsFromText(molt); for (int i = 0; i < lexRecords.Count; i++) { lexRecord = (LexRecord)lexRecords[i]; Console.WriteLine(lexRecord.GetText()); Console.WriteLine("---------------------------------"); } lexRecord = ToJavaObjFromText(molt); Console.WriteLine(lexRecord.GetText()); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } } else if (args.Length == 1) { try { List <LexRecord> lexRecords = ToJavaObjs(args[0]); if (lexRecords.Count <= 0) { Environment.Exit(1); } else { for (int i = 0; i < lexRecords.Count; i++) { LexRecord lexRecord = (LexRecord)lexRecords[i]; Console.WriteLine(lexRecord.GetText()); Console.WriteLine(lexRecord.GetXml()); Console.WriteLine("---------------------------------"); InflVarsAndAgreements infls = new InflVarsAndAgreements(lexRecord); List <InflVar> inflVars = infls.GetInflValues(); for (int j = 0; j < inflVars.Count; j++) { InflVar inflVar = (InflVar)inflVars[j]; Console.WriteLine("unInfl: " + inflVar.GetUnInfl() + "; infl: " + inflVar.GetInflection() + "; var: " + inflVar.GetVar()); } } } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } } else { Console.Error.WriteLine("*** Usage: java ToJavaObjApi <filename>"); Environment.Exit(1); } }