[Fwd: Re: [xml] validation automatically turned on?]

sorry I hit the wrong button..

-------- Original Message --------
Subject: Re: [xml] validation automatically turned on?
Date: Tue, 04 Feb 2003 18:00:27 +0100
From: Stefano Debenedetti <ste webaccess mozquito com>
To: Justin Fletcher <justin fletcher ntlworld com>
References: <3E3F3931 5030204 webaccess mozquito com> <20030204052440 G18071 redhat com> <3E3FE48C 9020205 webaccess 
mozquito com> <334290bf4b Justin gerph movspclr co uk>

thanks a lot, I will look at that, is there any way of doing that in python? If I manage to do that I could 
also submit a patch for the docs about it...

I still don't understand why that does not happen when I try with the interactive python shell though...


Justin Fletcher wrote:
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)


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.

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