That said, maybe lxml can do something similar too? Rather than register a libxml2 callback globally, only do it before entering the APIs that actually do file resolving. Seems there's only a few entry points for that, basically initial parsing and xinclude, but I didn't dig too deeply. Calling those functions shouldn't have much performance impact, they are just swapping pointers in C. I'm curious your thoughts
I think libvirt can be extended here to workaround the conflict with something like:
diff --git a/src/util/virxml.c b/src/util/virxml.c .248c5d7b2 100644 er(int domcode, >sax->error = catchXMLError;
index 6e87605ea.
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -810,9 +810,12 @@ virXMLParseHelp
pctxt-
if (filename) { tyLoader origloader = xmlGetExternalE ntityLoader( ); ntityLoader( xmlNoNetExterna lEntityLoader) ; (pctxt, filename, NULL,
XML_ PARSE_NONET |
XML_ PARSE_NOWARNING ); ntityLoader( origloader) ; pctxt, BAD_CAST xmlStr, url, NULL,
XML_PARSE_ NONET |
+ xmlExternalEnti
+ xmlSetExternalE
xml = xmlCtxtReadFile
+ xmlSetExternalE
} else {
xml = xmlCtxtReadDoc(
That said, maybe lxml can do something similar too? Rather than register a libxml2 callback globally, only do it before entering the APIs that actually do file resolving. Seems there's only a few entry points for that, basically initial parsing and xinclude, but I didn't dig too deeply. Calling those functions shouldn't have much performance impact, they are just swapping pointers in C. I'm curious your thoughts