ó úàÜdc@sddlZddlZyddlZejZWnddlZejZnXidd6dd6dd6ZdZedZedZd „Z d gdd d d „Z e dddedddddd.d/d0gƒej e ƒe dddedddddd1d2gƒe dddedeƒe dddededd „dddd3d4gƒe dd#dededddd5d6d7gƒe dd$dd%ddd&d'd(d)ƒyxe rÅejƒq²WWnek rÚnXe dd*dd%dddddd8d9d:gƒd,GHejd-ƒdS(;iÿÿÿÿNsa scatalogs/catalog.xmls &sample.entity;sxml/sample.xmlsE sdtds/sample.dtds py://strings/cCsA|jtƒsdS|ttƒ}|tkr3dStt|ƒS(N(t startswithtprefixtNonetlent pystringststr_io(tURItpath((sJ/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/input_callback.pyt my_input_cb&s  tverifiedtrootsreplacement textcsÆtjtjBtjB}g‰‡fd†} ‡fd†} tj| dƒy±tj||ƒ} | j| dƒ|dk rŒ| j|ƒn|dk r¢|ƒn| j ƒ| j ƒ} d} | j ƒ}|j |krñ|j |krñd} n| jƒWntjk rd} nX| |krGd||| fGHtjdƒn{ˆ|krÂd|GHd GHx#|D]\}}d ||fGHqhWd GHx#ˆD]\}}d ||fGHq“WtjdƒndS( Ncsˆjd|fƒdS(Niÿÿÿÿ(tappend(tctxtmsg(t actual_err(sJ/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/input_callback.pytmy_global_error_cb4scsˆj||fƒdS(N(R (targR tseveritytreserved(R(sJ/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/input_callback.pytmy_ctx_error_cb6stloadedR s not loadeds1Test '%s' failed: expect status '%s', actual '%s'isTest '%s' failedsExpect errors:s [%2d] '%s'sActual errors:(tlibxml2tXML_PARSE_DTDLOADtXML_PARSE_NONETtXML_PARSE_COMPACTtregisterErrorHandlerRtcreateURLParserCtxttsetErrorHandlertaddLocalCatalogt parseDocumenttdoctgetRootElementtnametcontenttfreeDoct parserErrortsystexit(tdesctdocpathtcatalogt exp_statustexp_errt test_callbackt root_namet root_contenttoptsRRtparserRt actual_statustetstm((RsJ/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/input_callback.pytrun_test/sB           R&s&Loading entity without custom callbackR'R(R)s not loadedR*sI/O s warning : s=failed to load external entity "py://strings/xml/sample.xml" s#Loading entity with custom callbackRsAAttempt to load network entity http://example.com/dtds/sample.dtdis#Entity 'sample.entity' not defined s/Loading entity with custom callback and catalogs)Loading entity and unregistering callbackR+cCs tjƒS(N(RtpopInputCallbacks(((sJ/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/input_callback.pytpsis>failed to load external entity "py://strings/dtds/sample.dtd" s3Retry loading document after unregistering callbacks7Loading using standard i/o after unregistering callbackstst.xmlR,RR-tbars<Loading using standard i/o after unregistering all callbackss)failed to load external entity "tst.xml" tOKi(iÿÿÿÿsI/O (iÿÿÿÿs warning : (iÿÿÿÿs=failed to load external entity "py://strings/xml/sample.xml" (iÿÿÿÿsAAttempt to load network entity http://example.com/dtds/sample.dtd(is#Entity 'sample.entity' not defined (is>failed to load external entity "py://strings/dtds/sample.dtd" (is#Entity 'sample.entity' not defined (iÿÿÿÿsI/O (iÿÿÿÿs warning : (iÿÿÿÿs=failed to load external entity "py://strings/xml/sample.xml" (iÿÿÿÿsI/O (iÿÿÿÿs warning : (iÿÿÿÿs)failed to load external entity "tst.xml" (R$RtStringIORtioRRtstartURLtcatURLRRR4tregisterInputCallbacktTrueR5t IndexErrorR%(((sJ/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/input_callback.pytsv          (