[xml] libxml2 - schema patch



Hi,

please find attached a patch for the schema processor of libxml2.
It tries to implement the build of attribute uses and
wildcards as well as the validation with those.
Regression tests ran fine.

Please have a look at new structures like "_xmlSchemaAttributeLink"
and "_xmlSchemaWildcardNs"; they are just used to build lists and
I'm not sure if this is OK for libxml2.


It implements the following:

1. Building of attribute uses on <complexType>s.
    This does not handle: derivation-ok-restriction  2.1.2
      The type definition must be validly derived, if the
      derivation method is "restriction".

2. Building of attribute wildcards on <complexType>s and
     <attributeGroup>s (intersection in attributeGroups and
     union if deriving).
    This does not handle "processContents" yet: it behaves as if the
    "processContents" of all attribute uses was marked with "lax".

3. Fixed Validation by attribute uses and added validation by attribute
     wildcards.

4. Fixed access to global types and declarations if <import> is used.

Problems:

1. xmlSchemaIsDerivedFromBuiltInType should use xmlSchemaValType as
    valType, but xmlSchemaValType is not public; thus a search for the
    type xsd:ID is done using a hardcoded value of "23".

2. There won't be enough room in xmlParserErrors to hold all schema
    errors in the range lower to 1800.


Notes:
1. Both  XML_SCHEMAS_ELEM_TOPLEVEL and XML_SCHEMAS_ELEM_GLOBAL existed:
    all semantic was changed to use XML_SCHEMAS_ELEM_GLOBAL instead.
    XML_SCHEMAS_ELEM_TOPLEVEL was marked as obsolete in the description.

2. Regression error result files have changed:
    attruse_0_1.err, attruse_0_2.err    


Patch files:
xmlschemas.c.diff, schemasInternals.h.diff, xmlerror.h.diff

Test files:

1. derivation-ok-restriction-2-1-1_0.xsd -
    derivation-ok-restriction-2-1-1_0.xml (reports errors)
2. derivation-ok-extension_0.xsd - derivation-ok-extension_0.xml
3. derivation-ok-extension-err_0.xsd -
    derivation-ok-extension-err_0.xml (reports error)

1., 2. & 3. need additional xsd files:
    anyAttr.importA.1_0.xsd, anyAttr.importA.1_0.xsd

4. bug141333.xsd - bug141333.xml (a modified version, since the xsd was
    invalid in the bug report). The bug seems to be fixed now.

5. anyAttr1_0.xsd - anyAttr1_0.xml
6. anyAttr-errors1_0.xsd - anyAttr-errors1_0.xml (reports errors)
7. anyAttr-derive1_0.xsd - anyAttr-derive1_0.xml


Greetings,

Kasimier

Attachment: derivation-restriction-anyType.xml
Description: Text Data

Attachment: xmlerror.h.diff
Description: Text Data

Attachment: xmlschemas.c.diff
Description: Text Data

Attachment: attruse_0_1.err
Description: Text document

Attachment: attruse_0_2.err
Description: Text document

Attachment: anyAttr.importA.1_0.xsd
Description: Text Data

Attachment: anyAttr.importB.1_0.xsd
Description: Text Data

Attachment: anyAttr1_0.xsd
Description: Text Data

Attachment: anyAttr-derive1_0.xsd
Description: Text Data

Attachment: anyAttr-derive-errors1_0.xsd
Description: Text Data

Attachment: bug141333.xsd
Description: Text Data

Attachment: derivation-ok-extension_0.xsd
Description: Text Data

Attachment: derivation-ok-extension-err_0.xsd
Description: Text Data

Attachment: derivation-ok-restriction-2-1-1_0.xsd
Description: Text Data

Attachment: derivation-restriction-anyAttr_0.xsd
Description: Text Data

Attachment: derivation-restriction-anyType.xsd
Description: Text Data

Attachment: anyAttr1_0.xml
Description: Text Data

Attachment: anyAttr-derive-errors1_0.xml
Description: Text Data

Attachment: anyAttr-errors1_0.xml
Description: Text Data

Attachment: bug141333.xml
Description: Text Data

Attachment: derivation-ok-extension_0.xml
Description: Text Data

Attachment: derivation-ok-extension-err_0.xml
Description: Text Data

Attachment: derivation-ok-restriction-2-1-1_0.xml
Description: Text Data

Attachment: derivation-restriction-anyAttr_0.xml
Description: Text Data

Attachment: schemasInternals.h.diff
Description: Text Data

Attachment: anyAttr-derive1_0.xml
Description: Text Data



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