removed the dummy root 'xml' tag from rspec view
authorGiovanni Gherdovich <ggherdov@brentaal.inria.fr>
Wed, 15 Sep 2010 10:13:44 +0000 (12:13 +0200)
committerGiovanni Gherdovich <ggherdov@brentaal.inria.fr>
Wed, 15 Sep 2010 10:13:44 +0000 (12:13 +0200)
sface/screens/rspecscreen.py

index e6a75d1..2354b2a 100644 (file)
@@ -25,6 +25,15 @@ class DomModel(QAbstractItemModel):
     def __init__(self, document, parent = 0):
         QAbstractItemModel.__init__(self, parent)
         self.domDocument = document
+        # one of the children of the rootItem is the 'xml' thing.
+        # here I delete it.
+        childList = document.childNodes()
+        for i in range(childList.count()):
+            currElem = childList.item(i)
+            if (currElem.nodeType() ==
+                QDomNode.ProcessingInstructionNode):
+                document.removeChild(currElem)
+                break
         self.rootItem = DomItem(document, 0);
 
     def data(self, index, role):
@@ -62,7 +71,8 @@ class DomModel(QAbstractItemModel):
             elif node.nodeType() == QDomNode.EntityNode:
                 return QString('unsupported node type')
             elif node.nodeType() == QDomNode.ProcessingInstructionNode:
-                return node.nodeName()
+                return QVariant()
+                #return node.nodeName()
             elif node.nodeType() == QDomNode.CommentNode:
                 return QString('#').append(node.nodeValue())
             elif node.nodeType() == QDomNode.DocumentNode: