[xml] =?ISO-8859-1?Q?Re=3A=20=27Re=3A=20=5Bxml=5D=20=22XML=20Schema=20attribute=20use=20patch=2C=20the=20second=22=27?=
- From: Kasimier Buchcik <kbuchcik 4commerce de>
- To: <xml gnome org>
- Subject: [xml] Re: 'Re: [xml] "XML Schema attribute use patch, the second"'
- Date: Mon, 19 Apr 2004 14:09:25 +0200
Hi,
on 4/16/2004 6:50 PM Daniel Veillard wrote:
On Fri, Apr 16, 2004 at 04:55:23PM +0200, Kasimier Buchcik wrote:
Hi,
Please find attached a possible patch for bug #136678 [1]. It implements
validation of the attribute "use" XML Schema item. Feel free to modify.
I'm a bit unsure about how to name and where to put the additional
constants and error types.
I don't know if the last patch made it to the list. It had the drawback
that if an attribute, invalid due to the "use" definition was
encountered, all following attributes were mistaken as invalid as well,
since the validation function was exited. This patch should be used
instead.
Additionally: It tries to solve bug #136678 - *not* bug #139791 as I
wrote in the last mail.
Excellent, this looks good, applied tested and commited along with the
test cases. I don't know why the error is reported 3 times, but except for
that small trouble this seems fine :-)
Invalid attributes are reported by "xmlSchemaCheckAttributes", called by
"xmlSchemaValidateElementType". The patch implements the report of
errors in "xmlSchemaValidateAttributes"; maby this is not the proper
place, since it is called multiple times for the same node. The
following should illustrate what happens:
(I marked some of the functions that are called during validation)
----
## foo - xmlSchemaValidateAttributes
## foo - xmlSchemaValidateContent
## foo - xmlSchemaValidateAttributes
## foo - xmlSchemaValidateComplexType
## barA - xmlSchemaValidateContent
## barA - xmlSchemaValidateAttributes
## barA - xmlSchemaValidateElementType
## barA - xmlSchemaValidateAttributes
## barA - xmlSchemaValidateContent
## barA - xmlSchemaValidateAttributes
file:///C%3A/dev/libxml2/builded/test/xsd_attr_use_test_invalid_tiny.xml:3:
element barA: Schemas validity error : Attribute "attr" is requi
red but missing on element "barA"
## barA - xmlSchemaValidateComplexType
## barA - xmlSchemaValidateAttributes
file:///C%3A/dev/libxml2/builded/test/xsd_attr_use_test_invalid_tiny.xml:3:
element barA: Schemas validity error : Attribute "attr" is requi
red but missing on element "barA"
## barA - xmlSchemaValidateAttributes
file:///C%3A/dev/libxml2/builded/test/xsd_attr_use_test_invalid_tiny.xml:3:
element barA: Schemas validity error : Attribute "attr" is requi
red but missing on element "barA"
## barA - xmlSchemaValidateAttributes
## barA - xmlSchemaValidateAttributes
## foo - xmlSchemaValidateAttributes
## foo - xmlSchemaValidateAttributes
validation failed!
----
So "xmlSchemaValidateAttributes" is called 3 times:
xmlSchemaValidateContent
-> xmlSchemaValidateAttributes (1)
-> xmlSchemaValidateComplexType
-> xmlSchemaValidateAttributes (2)
-> xmlSchemaValidateAttributes (3)
Since, I guess, the redundant calls are made to ensure that the
attributes are *really* validated, I tend to think that firing of the
"use" validation errors should go into "xmlSchemaCheckAttributes".
By the way: if the validation function is called so many times, it would
speed up things, if already checked attributes would be skipped, since
we got that information in ctxt->attr[i].state.
What do you think?
Greetings,
Kasimier
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]