Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Commit

Permalink
[Fixed] Load exist XMind raise Error
Browse files Browse the repository at this point in the history
Tidy xml output that will add extra new line as child node to node. Those new
lines exist as text node and must filter out.
  • Loading branch information
aqx committed Jul 23, 2013
1 parent 0c8bd24 commit 72ba10f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions xmind/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ def getChildNodesByTagName(self, tag_name):
"""
child_nodes = []
for node in self._node.childNodes:
if node.nodeType == node.TEXT_NODE:
continue

if node.tagName == tag_name:
child_nodes.append(node)

Expand Down
13 changes: 7 additions & 6 deletions xmind/core/workbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,15 @@ def __init__(self, node=None, path=None):
self._path = path
# Initialize WorkbookDocument to make sure that contains
# WorkbookElement as root.
_workbook_element = self.getChildNodesByTagName(const.TAG_WORKBOOK)
_workbook_element = self.getFirstChildNodeByTagName(
const.TAG_WORKBOOK)

self._workbook_element = WorkbookElement(
_workbook_element,
self)

if not _workbook_element:
self._workbook_element = WorkbookElement(ownerWorkbook=self)
self.appendChild(self._workbook_element)
else:
self._workbook_element = WorkbookElement(
self.documentElement,
self)

self.setVersion(const.VERSION)

Expand Down

0 comments on commit 72ba10f

Please sign in to comment.