title: Access the processing-instructions before/after a root element with lxml
body: <p>Using <a href="http://lxml.de" rel="nofollow noreferrer">lxml</a>, how can I access/iterate the processing-instructions located before the root open tag or after the root close tag?</p>
  
  <p>I have try this, but, according to the documentation, it only iterates inside the root element:</p>
  
  <pre class="lang-py prettyprint-override"><code>import io
  
  from lxml import etree
  
  content = """\
  &lt;?before1?&gt;
  &lt;?before2?&gt;
  &lt;root&gt;text&lt;/root&gt;
  &lt;?after1?&gt;
  &lt;?after2?&gt;
  """
  
  source = etree.parse(io.StringIO(content))
  
  print(etree.tostring(source, encoding="unicode"))
  # -&gt; &lt;?before1?&gt;&lt;?before2?&gt;&lt;root&gt;text&lt;/root&gt;&lt;?after1?&gt;&lt;?after2?&gt;
  
  for node in source.iter():
      print(type(node))
  # -&gt; &lt;class 'lxml.etree._Element'&gt;
  </code></pre>
  
  <p>My only solution is to wrap the XML with a dummy element:</p>
  
  <pre class="lang-py prettyprint-override"><code>dummy_content = "&lt;dummy&gt;{}&lt;/dummy&gt;".format(etree.tostring(source, encoding="unicode"))
  dummy = etree.parse((io.StringIO(dummy_content)))
  
  for node in dummy.iter():
      print(type(node))
  # -&gt; &lt;class 'lxml.etree._Element'&gt;
  #    &lt;class 'lxml.etree._ProcessingInstruction'&gt;
  #    &lt;class 'lxml.etree._ProcessingInstruction'&gt;
  #    &lt;class 'lxml.etree._Element'&gt;
  #    &lt;class 'lxml.etree._ProcessingInstruction'&gt;
  #    &lt;class 'lxml.etree._ProcessingInstruction'&gt;
  </code></pre>
  
  <p>Is there a better solution?</p>