Re: [xml] validation automatically turned on?

On Tue, Feb 04, 2003 at 04:21:35PM +0000, 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.

  Actually no. Libxml2 by default does not fetch the external subset.

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

  no, no, libxml2 default to the behaviour of non-validating parsers
described in the XML REC. But loading the external subset can be triggered 
independantly of the validation for example when doing XSLT processing.

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.

  Right. There are example in the python/test subdirectory to do this
directly from python.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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