def insert_comments(xml, insert_position, text): comment = Comment( text="{0} automatically inserted by beast_tools".format(text)) comment.tail = '\n\n\t' xml.insert(insert_position, comment) insert_position += 1 return xml, insert_position
def MakeCDATA(ele): cdata_str = ele.text.split('\n', 1)[1].replace('\n', '<![CDATA[', 1) + ']]>' cdata = Comment(' Generated CDATA -->\n' + cdata_str + '\n<!-- End of Generated CDATA ') cdata.tail = '\n' ele.append(cdata) ele.text = ''
def AppendComment(ele, txt): cmt = Comment(txt) cmt.tail = '\n' ele.append(cmt)
def insert_comments(xml, insert_position, text): comment = Comment(text="{0} automatically inserted by beast_tools".format(text)) comment.tail = "\n\n\t" xml.insert(insert_position, comment) insert_position += 1 return xml, insert_position