In the end, it looks like python code will call xmlNodeDumpOutput in the libxml2 library.
Unfortunately, there doesn't seem to be any way to tweak this to control the representation of such objects. By looking at .c objects in xmlEncodeEntitiesReentrant,> and and characters are hard-coded to always use the corresponding XML object, so there is no way to force it to use numeric values.
If you need it, you probably have to do another pass on the line and manually execute " outputString.replace("<","<") " for these characters.
source share