Re: [xml] validation automatically turned on?



In message <3E3FE48C 9020205 webaccess mozquito com>
          Stefano Debenedetti <ste webaccess mozquito com> wrote:

I think it's validating because, unless I remove the DOCTYPE decl, parsing
takes a few seconds instead of a fraction of a second and if I change the
DTD url in it to a non-existing one I get a NanoHTTP error saying that
external entity loading failed. Weird 'cause the code I use is:

That's because it's tried to fetch an external entity - your DTD. Unless you
tell it otherwise, it will go and fetch the DTD.

ctxt = libxml2.createFileParserCtxt(fileurl)
ctxt.validate(0)
ctxt.parseDocument()

[snip]

You're telling it not to validate, but it will still fetch the DTD so that
it can resolve entities. If you don't want any network activity on DTDs then
you will have to register an external entity loader function that rejects
them. In xsltproc this is the --nonet option and the
xmlNoNetExternalEntityLoader() function is the one you should be looking at
to do this.

-- 
Gerph {djf0-.3w6e2w2.226,6q6w2q2,2.3,2m4}
URL: http://www.movspclr.co.uk/
... Eyes to the heavens, screaming at the sky;
    Trying to send you messages, but choking on goodbye.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]