title: Python ElementTree support for parsing unknown XML entities?
body: <p>I have a set of super simple XML files to parse... but... they use custom defined entities.  I don't need to map these to characters, but I do wish to parse and act on each one.  For example:</p>
  
  <pre><code>&lt;Style name="admin-5678"&gt;
      &lt;Rule&gt;
        &lt;Filter&gt;[admin_level]='5'&lt;/Filter&gt;
        &amp;maxscale_zoom11;
      &lt;/Rule&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>There is a tantalizing hint at <a href="http://effbot.org/elementtree/elementtree-xmlparser.htm">http://effbot.org/elementtree/elementtree-xmlparser.htm</a> that XMLParser has limited entity support, but I can't find the methods mentioned, everything gives errors:</p>
  
  <pre><code>    #!/usr/bin/python
      ##
      ## Where's the entity support as documented at:
      ## http://effbot.org/elementtree/elementtree-xmlparser.htm
      ## In Python 2.7.1+ ?
      ##
      from pprint     import pprint
      from xml.etree  import ElementTree
      from cStringIO  import StringIO
  
      parser = ElementTree.ElementTree()
     #parser.entity["maxscale_zoom11"] = unichr(160)
      testf = StringIO('&lt;foo&gt;&amp;maxscale_zoom11;&lt;/foo&gt;')
      tree = parser.parse(testf)
     #tree = parser.parse(testf,"XMLParser")
      for node in tree.iter('foo'):
          print node.text
  </code></pre>
  
  <p>Which depending on how you adjust the comments gives:</p>
  
  <pre><code>xml.etree.ElementTree.ParseError: undefined entity: line 1, column 5
  </code></pre>
  
  <p>or</p>
  
  <pre><code>AttributeError: 'ElementTree' object has no attribute 'entity'
  </code></pre>
  
  <p>or</p>
  
  <pre><code>AttributeError: 'str' object has no attribute 'feed'           
  </code></pre>
  
  <p>For those curious the XML is from the <a href="http://www.openstreetmap.org/">OpenStreetMap</a>'s mapnik project.</p>