it doesn't complete for the object?
from xml.dom import minidom
document = """\
<slideshow>
<title>Demo slideshow</title>
<slide>
<title>Slide title</title>
<point>This is a demo</point>
<point>Of a program for processing slides</point>
<float>this is the first float </float>
</slide>
<slide>
<title>Another demo slide</title>
<point>It is important</point>
<point>To have more than</point>
<point>one slide</point>
<float>this is the second float </float>
</slide>
</slideshow>
"""
dom = minidom.parseString(document)
slideshows = dom.getElementsByTagName("point")
for slideshow in slideshows:
# print slideshow.getElementsByTagName('point')[0].firstChild.data
print slideshow.
> here it doesn't autocomplete
document = """\
<slideshow>
<title>Demo slideshow</title>
<slide>
<title>Slide title</title>
<point>This is a demo</point>
<point>Of a program for processing slides</point>
<float>this is the first float </float>
</slide>
<slide>
<title>Another demo slide</title>
<point>It is important</point>
<point>To have more than</point>
<point>one slide</point>
<float>this is the second float </float>
</slide>
</slideshow>
"""
dom = minidom.parseString(document)
slideshows = dom.getElementsByTagName("point")
for slideshow in slideshows:
# print slideshow.getElementsByTagName('point')[0].firstChild.data
print slideshow.
> here it doesn't autocomplete
请先登录再写评论。
After that things seem to be less clear. There is no inferred type information available for the call to getElementsByTagName(). Also Go to Declaration offers to possible methods to go to (one in class Element and one in class Document). I guess that's the reason why completion stops working. It's interesting that Element shows up here as well, because there is no inheritance relationship. It only shares the base class with Document.
Given how complicated parseString() is (calls multiple levels deep, conditional imports), I'm amazed that there is code completion for this at all...
code analysis in complicated for lxml module and we're trying to do our best.
As a workaround you can specify type for the slideshows (please see webhelp)