Re: [xml] validation automatically turned on?

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:

ctxt = libxml2.createFileParserCtxt(fileurl)

or directly:


As I said earlier the above code in the python interactive shell does not validate but it does when I use it 
in my app, which is a Twisted plugin [1]. Is there any chance that the global variable gets overridden by 
Twisted? I will try to debug it now, any hint much appreciated.

I am planning not to use DTD validation in any way in my app so is there a way I can make sure it never 
happens i.e. disabling support for it in the library?

One last thing: even if that file is an xhtml doc I really am interested in it only as generic xml but I've 
seen that libxml builds an HTML object model out of it.. is there any way I can disable that behavior and 
have it parsed just as a generic xml file instead of html?

Thank you, ciao


Daniel Veillard wrote:
On Tue, Feb 04, 2003 at 04:53:21AM +0100, Stefano Debenedetti wrote:

Hi, I am experiencing a strange behavior using libxml2.5.1 python bindings on a debian woody: I have an 
application that parses many xml files and one of them is an xhtml file referencing the dtd on the w3c site. 
It seems that when parsing that file validation is turned on even if i just use a libxml2.parseFile call...
I also tried to create a parser context and call validate(0) on it but validation happens anyway...
I tried to do the same thing using the interactive python shell but I cannot replicate the behavior: the same 
code does not do validation, as expected.
Are there any circumstances under which validation is automatically turned on?

  Hum, not that I can think of. The flag is inherited from a global
variable when creating the context. What make you believe it's validating
just for that file ? Error messages ?


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