+ if self.document.childNodes().count() == 0:
+ # empty document - do nothing
+ pass
+ elif self.document.childNodes().item(0).nodeType() == QDomNode.ProcessingInstructionNode:
+ # the first item is the <xml> tag, so expand the second
+ self.view.expand(self.model.index(1,0))
+ else:
+ # the document didn't start with an <xml> tag; let's try to expand
+ # the first item on the assumption that it is our root level xml
+ # tag.
+ self.view.expand(self.model.index(0,0))