Exemplo n.º 1
0
    def __init__(self, filename=None):
        """Initialize Handler object. Input - path to xtm file
        (filename=None) - if xtm file exists, then parse it, otherwise create new TopicMap
        """
        if filename and os.path.exists(filename):
            parser = Parser()
            self._tm = parser.parse(filename)
        else:
            self._tm = TopicMap("0")

        self._filename = filename
Exemplo n.º 2
0
 def createTopicMap(self, id):
     """Return new TopicMap objct with given id"""
     return TopicMap(id)
Exemplo n.º 3
0
 def _parse_topicMap(self, tmNode):
     """parse topicMap node -> TopicMap"""
     id = tmNode.getAttribute("id")
     topicMap = TopicMap(id, self._encoding)
     self._addChild(topicMap, tmNode)
     return topicMap