Re: [xml] Strange validation errors in libxml 2.9.0 with MSVC 2010



Hi all,
just to let you know, I found at least two causes for triggering this fake DTD validation problem, and I've found a solution for both:
1. If your path contains backslashes, it won't work; this can be mitigated with replacing backslashes with forward slashes prior to writing the path.
2. If you path contains spaces, it won't work; this can be mitigated with replacing each space with a %20. There a a lot of spaces on the Windows platform, starting with the project dir, for example: <username>\My Documents\Visual Studio 2012\Projects\<ProjectName>\Debug\mydtd.dtd. How many spaces did you count?

Using both of these workarounds made my programs validate XML documents normally, without any hickups.

I'd expect that:
 - in the future, libxml will spit out a more sensible error message than "Validation failed: no DTD found" for such errors - after all, it was the file that was not found.
 - issue #1 is technically a bug in libxml, however it's platform-specific and the workaround in pretty easy, do I am guessing that it will be most likely left alone - unless of course libxml author(s) want to claim that it's standards compliant (so the platform-specific stuff will have to be added).
 - issue #2 should be fixed as it is, in fact a real bug in libxml, regardless the platform of choice.

All you need to do is check the external entities in the XML standard:
http://www.w3.org/TR/REC-xml/#sec-external-ent
and follow it all the way to the format of SystemLiteral:
http://www.w3.org/TR/REC-xml/#NT-SystemLiteral
You'll find that space is in fact, a valid character - and so is backslash:
SystemLiteral   ::=   ('"' [^"]* '"') | ("'" [^']* "'")
Only single and double quote characters are forbidden; both backslash and spaces (plus a bunch of others that I guess won't work like 0x0A, 0x0D) are permitted in SystemLiteral.

If you keep reading further, you'll notice that the tightly restricted PubidLiteral also allows for spaces specifically (but not backslashes):

PubidLiteral   ::=   '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 
PubidChar   ::=   #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*# $_%]

I am hope you'll have time to fix it eventually; thank you in advance.
Happy New Year to you all!



Best regards: Zoltán Ördögh


On Sun, Apr 28, 2013 at 2:36 PM, Zoltán Ördögh (GMail) <csimbi gmail com> wrote:
Hi,
not a lot of help I know, but this is all I have to offer right noww.

I think, Ubuntu does upgrades pretty well. I have upgraded from 9.x to 12.x each release (have not tried 13.x yet) and I had only one minor problem (with grub), so I'd like to think you can rule out the upgrade issue. But, yes, do give it a try if you have the time - you never know.

It's the ghost in the machine :-)


Best regards: Zoltán Ördögh


On Sun, Apr 28, 2013 at 1:32 PM, brezhoneg1 <brezhoneg1 yahoo fr> wrote:
Hi

   thanks a lot for your response

   So far, it occurs on a Ubuntu13.04 32-bits (an upgrade from Ubuntu12.10 which already was an upgrade from Ubuntu12.04). These two upgrades went without problems, but maybe a clean installation from scratch  would
 be better to avoid risks of silent misfunctioning due to a bad cleanup of a previous version. For 64 bits, I don't know yet (not tested), but I guess this bug is likely to be on all platforms, since you've got it on Windows too.

  Anyway, the programs run very well, except they emit hundreds of irrelevant error messages that will surely scare end users for nothing !

Best Regards
E. Lintari

Le 28/04/2013 17:08, Zoltán Ördögh (GMail) a écrit :
Hi,
thanks for checking in.

As far as I know, there is no solution for this problem yet.
Daniel recommended to debug into xmllib to find out what the problem might be - I simply don't have the bandwidth to do that.
So, I opted for avoiding the problem as a whole by downgrading to 2.8.0.

I guess this makes the fix more urgent - it's a bit harded to downgrade Ubuntu deployments.
Is this happening on a 32bit distribution, 64bit or both?

Best regards: Zoltán Ördögh


On Sun, Apr 28, 2013 at 6:29 AM, brezhoneg1 <brezhoneg1 yahoo fr> wrote:
Hi,

   I just upgraded to Ubuntu13.04 that comes with libxml2.9.0, and I experience these exact same errors.
   C++ programs that used to work very fine with previous versions now show all these errors when compiled on this
   new Linux version. When using xmllint, everything's ok though. These programs load a DTD from a local file in the form of /home/user/prg/application.dtd then read XML files that use this DTD.

   Was the problem eventually fixed for your case ? If so, what was the underlying issue, since it is most likely the same one ?

Regards
E. Lintari







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