From 9fca602defd316cc01cd3d421f9a65342ed76289 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Wed, 5 Mar 2008 16:59:17 +0100 Subject: [PATCH] MusicXML: Properly detect when a node is the lxml tree is a comment --- python/musicxml.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/musicxml.py b/python/musicxml.py index 7c398e1e5d..0e63c5ecdb 100644 --- a/python/musicxml.py +++ b/python/musicxml.py @@ -953,9 +953,8 @@ def get_class (name): def lxml_demarshal_node (node): name = node.tag - # TODO: This is a nasty hack, but I couldn't find any other way to check - # if the given node is a comment node (class _Comment): - if name is None or re.match (u"^$", node.__repr__()): + # Ignore comment nodes, which are also returned by the etree parser! + if name is None or node.__class__.__name__ == "_Comment": return None klass = get_class (name) py_node = klass() -- 2.39.5