<p>When editing an XML file in IntelliJ IDEA, if the document references a schema, IDEA will fetch the schema and use the information for auto-complete.  It knows which tags are valid in which contexts, so when you hit CTRL-space, it suggests only those tags.  It also highlights any tags that are invalid according to the schema.</p>

<p>Does anybody know of an extension for Vim that provides similar functionality?</p>

The closest thing that I've seen for Vim is the
XML Completion
script.
It contains XML definition files for DocBook 4.[234], XSL FO 1.0, XSLT 1.0, Relax NG 1.0, XML Schemas 1.0, SVG 1.1, XHTML 1.1, XInclude 1.0 and OpenOffice 1.0 XML format.