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
def createTopicMap(self, id): """Return new TopicMap objct with given id""" return TopicMap(id)
def _parse_topicMap(self, tmNode): """parse topicMap node -> TopicMap""" id = tmNode.getAttribute("id") topicMap = TopicMap(id, self._encoding) self._addChild(topicMap, tmNode) return topicMap