Re: [xml] "W3C XML Schema patch (simple type)"



On Tue, Jun 29, 2004 at 03:14:47PM +0200, Kasimier Buchcik wrote:
Hi,

Here are some patches for the W3C XML Schema processor of libxml2.

  good thing it's about "simple" types, I wonder how large the "complex"
type code will end up being :-)

The patches contain the following:

1. Checks for src-simple-type 1, 2, 3, 4 (partly)
2. Checks for st-props-correct
3. Almost all checks cos-st-restricts
4. Checks for cos-st-derived-ok
5. Started support for "final" of complex type
   (for simple type it is already done)
   flags:
     XML_SCHEMAS_TYPE_FINAL_EXTENSION,
     XML_SCHEMAS_TYPE_FINAL_RESTRICTION,
     XML_SCHEMAS_TYPE_FINAL_LIST,
     XML_SCHEMAS_TYPE_FINAL_UNION,
     XML_SCHEMAS_TYPE_FINAL_DEFAULT
6. Variety of simpleType:
     XML_SCHEMAS_TYPE_VARIETY_ABSENT,
     XML_SCHEMAS_TYPE_VARIETY_ATOMIC,
     XML_SCHEMAS_TYPE_VARIETY_LIST,
     XML_SCHEMAS_TYPE_VARIETY_UNION
7. "finalDefault"
   New flags:
     XML_SCHEMAS_FINAL_DEFAULT_EXTENSION,
     XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION,
     XML_SCHEMAS_FINAL_DEFAULT_LIST,
     XML_SCHEMAS_FINAL_DEFAULT_UNION

Please shout if I overly strain the flags with this.

  Should be fine. We can assume 32bits per int, and you're only at 15 so far !

8. Union:
   Added a field "memberTypes" to the xmlSchemaType. This struct
   becomes a "one for all" conglomerate type - not very nice; I hope
   we can split this big mama into some more specialized offshoots in the
   future to prevent it from eating up memory unnecessarily. For now,
   working with just a singe struct for many of the schema toys eases
   the work.

  Optimization will be done at a later stage, the only problem is that
changing public memory structures won't be easy, but there is plenty
of tricks doable once you know the code won't change much, which is 
not the case yet :-)

9. Added a xmlSchemaTypeLink to be used by "memberTypes" of a
   Union Simple Type.
10. Partly added support for attribute "fixed" of facets (see TODO below).
11. Partly fixed facets for List Simple Types (see TODO below).
12. Fixed typo in xmlSchemaCompareDecimals; this bug was reported by
   Morgan L. Owens to the mailing-list, but not processed yet
   (http://mail.gnome.org/archives/xml/2003-December/msg00221.html)
13. Added some checks for type validation of schema attributes (e.g. 
"name", "itemType")
14. An attribute's base type is now the anySimpleType if no types are 
specified.
15. Plugged the anyType into the derivation hierarchy of complex types;
   this needed some more adjustments, since the processor tried to
   live without anyType until now. This is still not complete: the 
intergration
   of the particle of the content type of anyType is not done yet. This 
intergration is a worry
   to me, and I expect some funny complexTypes to crash, before 
extensive tests for complex
   types are done (the existent regression test won't suffice here).
16. made "xmlSchemaCollapseString" public to be used on values of list 
simple types.
17. Added public "xmlSchemaIsBuiltInTypeFacet" to evaluate if a facet 
can be used in
   conjunction with a built-in type.
18. Fixed default value for "elementFormDefault".
19. ... other things.

Patch files:

xmlschemas.c.diff, xmlschemastypes.c.diff, xmlschemastypes.h.diff,
xmlerror.h.diff, schemasInternals.h.diff

  Fantastic they applied without any problem, we are making progresses there
too :-)

Test files:

facet-unionST-err1_0.xsd - facet-unionST-err1_0.xml
cos-st-restricts-1-2-err_0.xsd - cos-st-restricts-1-2-err_0.xml
cos-ct-extends-1-3_0.xsd - cos-ct-extends-1-3_0.xml
bug143951_0.xsd - bug143951_0.xml - bug143951_0.imp

problems with regression tests:

vdv-first4_0.xsd - vdv-first4_2.xml (does report a wrong line number 
(1), maby due to
   the encoding, on win my editor says that it is "Mac" encoded.)

  heh :-)

Changed regression result files:

anyAttr-processContents-err1_0_0.err, attruse_0_1.err, attruse_0_2.err,
extension1_0_1.err, extension1_0_2.err, hexbinary_0_1.err, length3_0_0.err,
vdv-first4_0_1.err,  vdv-first4_0_2.err, ns0_1_1.err, ns0_1_0.err, 
ns0_0_4.err,
ns0_0_3.err

  okay

MS-Tests for simple types from the W3C XML Schema test suite:

Passes all tests except:
- tests that process the attribute "id" do fail, since the datatype 
check and uniqueness of this
   attribute is not implemented yet.

  it's of ID type ? Or a constraint, ID should work ...

- stC003 - fails since the test is not correct (the spec, Xerces and XSV 
are with me here)
- stI005 - fails since the test is not correct (the spec, Xerces and XSV 
are with me here)

Results for the NIST tests are to come...

   Excellent, thanks a lot !
Applied, there is a bit of cleanup needed but this looks really good :-)

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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