I'm trying to work through this answer in the QGIS (2.14) Python console to understand, ultimately, how to iterate over layers and print them with a template.
When I run the following code block.
I get a NameError that QDomDocument() is undefined.
myComposition = QgsComposition(myMapRenderer)
myFile = os.path.join(os.path.dirname(__file__), 'MMR_Template.qpt')
myTemplateFile = file(myFile, 'rt')
myTemplateContent = myTemplateFile.read()
myTemplateFile.close()
myDocument = QDomDocument()
Possibly related (can split into a separate question) I also get the warning DeprecationWarning: QgsComposition constructor is deprecated but can find nothing about this warning on Google.
from qgis.PyQt.QtXml import QDomDocument– Matthias Kuhn Dec 15 '16 at 23:47