t_line = t_line.replace(">", ">") t_line = t_line.replace("**", "<break/>") textAsLines.append(t_line) # /////////////////////// END OF REPLACEMENTS /////////////////////////// # qType = textfunctions.getQuestionTypeFromText(textAsLines) if qType == "CAN'T FIND QUESTION TYPE": raw_input("Problem with finding Question Type. Press Enter to quit.") sys.exit() xmlFromText = "" if qType == "drag1": xmlFromText = drag1.makeXmlFromText(textAsLines, fullClassName) if qType == "radio1": xmlFromText = radio1.makeXmlFromText(textAsLines, fullClassName) xmlOutputPath = os.path.join(xmlDirectory, t[:-3] + "xml") fh = open(xmlOutputPath, "w") fh.write(xmlFromText) fh.close() xmlFromText = "" # get working xml files xmlfiles = os.listdir(xmlDirectory) firstRun = True packageRoot = ""
textfiles = os.listdir(textDirectory) xmlFromText = "" for t in textfiles: fh = open(os.path.join(textDirectory, t)) textAsLines = fh.readlines() fh.close() qType = textfunctions.getQuestionTypeFromText(textAsLines) print qType if qType == "CAN'T FIND QUESTION TYPE": raw_input("Problem with finding Question Type. Press Enter to quit.") sys.exit() if qType == "drag1": xmlFromText = drag1.makeXmlFromText(textAsLines) if qType == "radio1": xmlFromText = radio1.makeXmlFromText(textAsLines) xmlOutputPath = os.path.join(xmlDirectory, t[:-3] + "xml") fh = open(xmlOutputPath, "w") fh.write(xmlFromText) fh.close() xmlFromText = "" # get working xml files xmlfiles = os.listdir(xmlDirectory) firstRun = True packageRoot = ""