예제 #1
0
파일: idml.py 프로젝트: Starou/SimpleIDML
 def append_childs(source_node, destination_node):
     """Recursive function to discover node structure from a story to another. """
     for elt in source_node.iterchildren():
         if not elt.tag == "XMLElement":
             append_childs(elt, destination_node)
         if elt.get("Self") == source_node.get("Self"):
             continue
         if not elt.get("MarkupTag"):
             continue
         elt = XMLElement(elt)
         new_destination_node = elt.to_xml_structure_element()
         destination_node.append(new_destination_node)
         if elt.get("XMLContent"):
             xml_content_value = elt.get("XMLContent")
             story_name = "Stories/Story_%s.xml" % xml_content_value
             story = Story(self, name=story_name)
             try:
                 new_source_node = story.get_element_by_id(elt.get("Self"))
             # The story does not exists.
             except KeyError:
                 continue
             else:
                 append_childs(new_source_node, new_destination_node)
         else:
             append_childs(elt, new_destination_node)
예제 #2
0
파일: idml.py 프로젝트: mnvx/SimpleIDML
 def append_childs(source_node, destination_node):
     """Recursive function to discover node structure from a story to another. """
     for elt in source_node.iterchildren():
         if not elt.tag == "XMLElement":
             append_childs(elt, destination_node)
         if elt.get("Self") == source_node.get("Self"):
             continue
         if not elt.get("MarkupTag"):
             continue
         elt = XMLElement(elt)
         new_destination_node = elt.to_xml_structure_element()
         destination_node.append(new_destination_node)
         if elt.get("XMLContent"):
             xml_content_value = elt.get("XMLContent")
             story_name = "Stories/Story_%s.xml" % xml_content_value
             story = Story(self, name=story_name)
             try:
                 new_source_node = story.get_element_by_id(
                     elt.get("Self"))
             # The story does not exists.
             except KeyError:
                 continue
             else:
                 append_childs(new_source_node,
                               new_destination_node)
         else:
             append_childs(elt, new_destination_node)