With lxml I can:
from lxml import etree
parser = etree.XMLParser(resolve_entities=False)
Can I do the same with xml.etree.ElementTree XMLParser?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A quick look at the source code shows nothing as easy as
resolve_entities=False.Here is an extract of the source of xml.etree.ElementTree.XMLParser:
There are no other pyexpat handlers configured.
Now, are you interested in well-known XML entities like
&or others? It seems like undefined entities are going throughXMLParser._defaultso you might get something by extending that method.But what are you trying to accomplish with this? If this is only adding new entities, try updating the
XMLParser.entitydict.