[ expat-Patches-584041 ] expat should check XML version attribute

noreply@sourceforge.net noreply@sourceforge.net
Mon Jul 22 09:30:03 2002


Patches item #584041, was opened at 2002-07-19 17:54
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=310127&aid=584041&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Håkan Waara (hwaara)
Assigned to: Karl Waclawek (kwaclaw)
Summary: expat should check XML version attribute

Initial Comment:
In the XML spec it says that the parser may throw a 
parser error if the version is not "1.0" in the XML 
declaration. This is also what IE6 does.

Here's a patch for this. It was diffed against mozilla.org's 
expat version, but I hope it can still be applied.

Thanks,  -Håkan

----------------------------------------------------------------------

>Comment By: Karl Waclawek (kwaclaw)
Date: 2002-07-22 12:29

Message:
Logged In: YES 
user_id=290026

I like the idea of leaving it to the application
to make the call: error or not.

Given the other arguments (mine included <g>)
I reverse my vote - I am now in favour of the status quo.

We will see what the experiences with the Mozilla 
version of Expat (where this patch comes from) will be ...

Karl

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-07-22 11:57

Message:
Logged In: YES 
user_id=3066

While I like being really picky about checking input, I
think there's a backward compatibility issue here.  To turn
version != "1.0" into an error, we break with expectations
established by previous releases.  Expat legacy does not
turn conditions into actual errors if it isn't necessary, so
"may" raise an error is not strong enough to go against
existing behavior.

If a particular application is interested in deteriming what
XML version was given, it may do so using
XML_SetXmlDeclHandler(), raising any sort of error
appropriate at that point.  This should be documented
(assign to me for docs once we reach agreement).

XML 1.1 feels sufficiently rough at this point that we don't
need to implement to it.

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-07-22 09:43

Message:
Logged In: YES 
user_id=290026

One caveat though:

What will happen with XML 1.1 documents that
also conform to XML 1.0? Should the parser reject them?
That might potentially exclude many "good" documents.

Maybe an option should be added to turn version
number errors of.

Karl

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-07-20 21:58

Message:
Logged In: YES 
user_id=290026

The patch didn't work for me, but I applied it manually
against my copy of the current CVS (xmltok.c 1.20) 
- with small cosmetic changes.

Attached as xmltok.diff.

I am in favour of it. Let's see what the others say.

Karl

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-07-20 11:59

Message:
Logged In: YES 
user_id=290026

Yes, I have read the spec too.
I also read about the XML 1.1 spec making it a requirement.

I am just putting it up for discussion.
Why don't you post to the expat-discuss list?

Karl

----------------------------------------------------------------------

Comment By: Håkan Waara (hwaara)
Date: 2002-07-20 11:51

Message:
Logged In: YES 
user_id=72743