³ò C‹ØEc@s‚d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „Z d „Z d „Z d „Z d „Z dS(cCsFddkl}|ƒ}t|ƒ}t|||ƒt||ƒdS(s5 Create an XML file that contains templates for the text editor. Each item in the template information list is a tuple containing the following: (language_id, trigger, description, template) @param template_info_list: A list of information about templates. @type template_info_list: A List object. iÿÿÿÿ(tDocumentN(txml.dom.minidomRtadd_root_elementt add_entriestwrite_document_to_file(ttemplate_info_listtfilenameRt xml_documentt root_element((s*plugins/TemplateEditor/WriteXMLTemplate.pytcreate_template_files    cCsEddkl}|ƒ}t|ƒ}t|||ƒt|ƒ}|S(Niÿÿÿÿ(R(RRRRtwrite_document_to_string(RRRRtstring((s*plugins/TemplateEditor/WriteXMLTemplate.pytcreate_template_strings    cCs%x|D]}t|||ƒqWdS(s Create entries for each template in the information list. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param root_element: The root element in an XML document. @type root_element: A instance object. @param template_info_list: A list of template information. @type template_info_list: A List object. N(tadd_entry_element(RRRttemplate((s*plugins/TemplateEditor/WriteXMLTemplate.pyRs cCs0t|dƒ}|i|ddƒ|iƒdS(s¨ Write the XML document object to an XML file. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. twtencodingsUTF-8N(topentwritexmltclose(RRt file_object((s*plugins/TemplateEditor/WriteXMLTemplate.pyR-s cCs|idƒ}|S(NsUTF-8(ttoxml(RR ((s*plugins/TemplateEditor/WriteXMLTemplate.pyR 9scCs |idƒ}|i|ƒ|S(sö Create the root element for the XML document. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @return: The root element of the XML document. @rtype: An instance object. tsnippet(t createElementt appendChild(RR((s*plugins/TemplateEditor/WriteXMLTemplate.pyR=s  cCsP|idƒ}|i|ƒt|||ƒt|||ƒt|||ƒdS(s] Create the entry element for the XML document. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param root_element: The root element in an XML document. @type root_element: A instance object. @param template: Information for a template. @type template: A Tuple object. tentryN(RRtadd_trigger_elementtadd_description_elementtadd_template_element(RRRt entry_element((s*plugins/TemplateEditor/WriteXMLTemplate.pyR Ks  cCsH|idƒ}|i|ƒt|d|dƒt|||dƒdS(sp Add a trigger element to the XML's document's entry element. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param entry_element: The trigger element in an XML document. @type entry_element: A instance object. @param template: Information for a template. @type template: A Tuple object. ttriggertidiiN(RRtadd_attribute_to_elementtadd_text_to_element(RRRttrigger_element((s*plugins/TemplateEditor/WriteXMLTemplate.pyR_s  cCs4|idƒ}|i|ƒt|||dƒdS(sx Add a description element to the XML's document's entry element. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param entry_element: The description element in an XML document. @type entry_element: A instance object. @param template: Information for a template. @type template: A Tuple object. t descriptioniN(RRR!(RRRtdescription_element((s*plugins/TemplateEditor/WriteXMLTemplate.pyRrs  cCs4|idƒ}|i|ƒt|||dƒdS(su Add a template element to the XML's document's entry element. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param entry_element: The description element in an XML document. @type entry_element: A instance object. @param template: Information for a template. @type template: A Tuple object. RiN(RRR!(RRRttemplate_element((s*plugins/TemplateEditor/WriteXMLTemplate.pyR„s  cCs|i||ƒdS(s Add an attribute to an element. @param element: Element to add an attribute to. @type element: An instance object. @param attribute: The name of the attribute. @type attribute: A String object. @param value: The value of the attribute. @type value: A String object. N(t setAttribute(telementt attributetvalue((s*plugins/TemplateEditor/WriteXMLTemplate.pyR –s cCs |i|ƒ}|i|ƒdS(s4 Add text to an element. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param element: Element to add an attribute to. @type element: An instance object. @param text: The text to add to an element. @type text: A String object. N(tcreateTextNodeR(RR'ttextt text_node((s*plugins/TemplateEditor/WriteXMLTemplate.pyR!¦s  cCs|i|ƒ}|S(s- Create an element for an XML document. @param xml_document: An object representing an XML document. @type xml_document: A xml.dom.minidom.Document object. @param name: The name of the element. @type name: A String object. @return: An element in a XML document. @rtype: An instance object. (R(RtnameR'((s*plugins/TemplateEditor/WriteXMLTemplate.pytcreate_element·s cCstS(sÆ Validate an XML file against an internal DTD. @param filename: An XML file to be validated. @type filename: A String object. @return: True if validation succeeds. @rtype: A Boolean object. (tTrue(R((s*plugins/TemplateEditor/WriteXMLTemplate.pyt validate_xmlÇs N(R R RRR RR RRRR R!R.R0(((s*plugins/TemplateEditor/WriteXMLTemplate.pyss