Commit Graph

87 Commits

Author SHA1 Message Date
Davide Brunato b7b6fef418 Base modules refactoring for fix ElementTree import 2019-10-07 15:31:18 +02:00
Davide Brunato 7fcacde313 Fix issue #136
- Protect facets validators from type and value errors
  - Add strictly_equal() helper to check fixed value equality
  - Move get_instance_type() from XsdType to global maps
2019-10-03 22:00:32 +02:00
Davide Brunato 23390a1ed7 Fix xs:keyref ref building and add count_digits() helper 2019-09-20 11:49:01 +02:00
Davide Brunato 07070ad714 Fix W3C instance tests
- Add iter_substitutes() to Xsd11Element to fix upa.xsd/upa2.xsd
    tests with instances. Now for XsdElement the abstract substitutes
    are simply ignored by iter_substitutes().
2019-09-11 18:43:13 +02:00
Davide Brunato 747036aad4 Fix for issue #127 and other W3C XML tests
- Added data_value() method to XsdElement and XsdAttribute()
  - Rename identity constraints dictionaries to 'identities'
  - Fix XSD 1.1 wilcards
2019-08-25 22:51:00 +02:00
Davide Brunato 6c47e49971 Fixing W3C XSD 1.1 schema tests
- Add XSD 1.1 skip list in W3C test script
  - Regex: check unescaped double hyphens (--)
  - Check model extension allowed types
2019-08-23 08:48:02 +02:00
Davide Brunato e6e009386a Fix library tests
- Fixed etree encoding checks for py2
  - Fixed XSD 1.1 meta-schema restriction checking
  - Set memory lazy tests to higher level (something
    changed after lazy meta-schema build, need to be
    checked with large XML files)
2019-08-20 22:10:12 +02:00
Davide Brunato 9e58e99e01 Add XSD 1.1 support and XSD components API to documentation 2019-08-19 13:52:30 +02:00
Davide Brunato 7a0dbf9afc Fix other XSD 1.1 parsing errors for wilcards 2019-08-17 09:36:24 +02:00
Davide Brunato 3ff9e8b010 Add openContent override to include notQName
- Replace list_builtins.xsd with xsd11-extra.xsd
2019-08-10 23:59:38 +02:00
Davide Brunato 52d1e1bb8e Close XSD 1.1 development
- Still some W3C and local tests to be fixed
  - Fix min/max facets derivation (decode with primitive type)
2019-08-05 17:57:34 +02:00
Davide Brunato 4661c1e0bf Complete versioning filter for XSD 1.1+
- etree_pruning() renamed to prune_etree
  - version_check() now is used only as selector for prune_etree()
    at schema initialization
2019-08-03 05:50:18 +02:00
Davide Brunato f2a30baf32 Fix XSD 1.1 bugs with W3C XML Schema suite 2019-08-01 17:16:12 +02:00
Davide Brunato df5c454b24 Add minimal schema for versioning namespace
- Added XMLSchemaNamespaceError for namespace related errors
  - version_check moved to schema class
  - resolve_qname() now raises KeyError if namespace prefix is not found
  - resolve_qname() now raises XMLSchemaNamespaceError if a namespace
    is mapped with a prefix but is not loaded by an import
2019-08-01 07:03:03 +02:00
Davide Brunato 6e90de7b4c Add Version Control namespace attributes
- Added xsd_version property to XSD components
  - Add version_check() helper to XsdValidator base class
2019-07-31 14:19:02 +02:00
Davide Brunato d4bb951a45 Improve schema checks
- Checked and improved 'built' properties for XSD components:
      * Simple types, attributes and attribute group are now built
        withoug cheching on base types.
      * Don't check global subcomponents: the scope of built is to
        assure that local parts are built.
  - Split global maps checks from build phase:
      * XsdGlobals._check_schema substituted by check() method with
        two opional arguments. The new methos is useful also to check
        global maps also after schema building.
  - Added validator=None argument to parse_error() method
2019-07-30 14:52:51 +02:00
Davide Brunato e26d20b770 Add restriction check for openContent 2019-07-19 18:54:19 +02:00
Davide Brunato d21ac11dde Fix default values decoding as reported by issue #108
- Default and fixed values are inserted during the decode or
    encode process
  - Update tox.ini to include coverage and flake8 to environments
    and an optional environment to build source and wheel packages
2019-05-31 09:29:41 +02:00
Davide Brunato 7fce51361e Fix issue #111
- Added a test case and a test method for this
  - Modified iter_components for XsdComplexType to also count the
    base type if it's a local declaration
  - Modified XsdGroup.iter_components() to yield also the redefined group
2019-05-29 06:47:40 +02:00
Davide Brunato b2302ee104 Add checks for multiple restriction case 2019-05-04 14:40:03 +02:00
Davide Brunato b36472bd6d Fix tests for a new release
- W3C test script cleaned
  - Fix attribute wildcard extension: new method extend_namespace()
  - Generate an error if schema has the attribute targetNamespace=''
  - Fix complexType redefinition checks
  - Fix UPA violation checking
2019-04-29 11:44:15 +02:00
Davide Brunato 9e1e25d985 Complete model checking (restriction and determinism) 2019-04-24 19:40:38 +02:00
Davide Brunato 36dbb1a904 Move and fix XsdType.is_derived()
- Method replaced by an abstract method and moved to XsdSimpleType
2019-04-15 18:49:42 +02:00
Davide Brunato 8f4eaaa46c Fix model group checking
- Refactoring ParticleMixin hierarchy
2019-04-15 13:07:31 +02:00
Davide Brunato e6fd152843 Fix simple restriction checking 2019-04-11 07:09:19 +02:00
Davide Brunato 7b77f6be14 Split XSD group validators from model
- Code cleaning and refactoring in order to complete model verifiers
2019-04-09 16:56:28 +02:00
Davide Brunato 14ac859b33 Write redefinition checking
- Added class attribute redefine=None to XSD types and groups: this
    attribute is ovverridden by instance attribute in case of a redefine
2019-04-07 11:50:22 +02:00
Davide Brunato 54c4297335 Complete complexType models checking 2019-04-05 18:24:09 +02:00
Davide Brunato 58af73dd1b Refine checks on models and restrictions 2019-04-04 09:06:46 +02:00
Davide Brunato 64d21997a5 Additional fixes for checking invalid schemas 2019-03-31 09:35:50 +02:00
Davide Brunato c2f5512f0d Fixes for schemas with substitution groups
- Build of substitution groups moved into XsdElement code
2019-03-28 14:08:36 +01:00
Davide Brunato 85cdd364ad Fix facets for XSD builtin types
- Added facets to numerical XSD builtins but keep validator functions
  - More checks on min/max value facets
  - Removed HFP namespace from base schemas (used only for meta-schema wildcars)
2019-03-28 07:26:36 +01:00
Davide Brunato b221fa255f Bugfix for attributes and attribute groups 2019-03-27 11:59:22 +01:00
Davide Brunato f1427a3335 Fix complex restriction checking
- ParticleMixin.is_restriction() renamed to has_particle_restriction()
2019-03-22 18:17:57 +01:00
Davide Brunato 37595da57c Add model checks after schema build
- Added check on type matching of same elements
  - Added XsdGroup.check_particles() for check Unique Particle Attribution
    Constraint of schema
  - Fixed group redefine (clear in any case when _parse begins)
2019-03-21 07:14:58 +01:00
Davide Brunato d4207cd457 Fix the substitution groups build phase
- Select schema's substitution groups instead of the ones of the namespace
2019-03-15 10:26:51 +01:00
Davide Brunato 5917873b7f Add resolve_qname() to XMLSchemaBase
- Replace prefixed_to_qname() with resolve_qname()
  - Code cleaning for helpers.py module
  - Add schema defaults as XMLSchemaBase class attributes
2019-03-14 15:18:28 +01:00
Davide Brunato 2671d90aa3 Fix listing of errors and lookup errors representation
- Refine iter_components for schemas: now filter the globals that
    don't belong to the schema (same namespace but different schemas)
  - Cleaned XsdGlobals.all_errors property
2019-03-11 22:00:32 +01:00
Davide Brunato 2aa5ed0037 Fix schema 'built' property
- Added a last chance check for schemas that have no globals
    defined
  - Added XsdGlobals.lookup()
2019-03-11 10:49:19 +01:00
Davide Brunato 75a1356778 Add XMLSchemaBase.create_meta_schema() class method
- Replace equivalent code in XMLSchemaMeta
  - Used by XsdGlobals to replace meta schema in case of import of
    a base-schema namespace (XSD, XSI, XML, XLINK, HFP)
  - Added meta_maps argument to XMLSchemaBase
2019-03-11 07:03:40 +01:00
Davide Brunato 069146fd22 Integrating with W3C test suite
- Fix the decoding of attributes with a default value
  - Fix parse of the element type
  - Fix parse of the element block attribute
2019-03-06 17:09:16 +01:00
Davide Brunato 8d7e6d162c Fix error collecting for XsdGlobals
- Added a custom property all_errors that iterates on schemas
  - Fix counting of total errors in test_schemas.py
2019-03-06 10:08:21 +01:00
Davide Brunato 9cc61e8788 Rewrite assertions implementation 2019-02-22 22:50:05 +01:00
Davide Brunato d746e4918a Clean and improve facets usage
- Removed FACETS, LIST_FACETS, UNION_FACETS from schema classes
  - Added admitted_facets argument to XsdAtomicBuiltin class
2019-02-11 17:15:17 +01:00
Davide Brunato bbbbbe0873 Add override tag and XMLSchema11._include_schema() 2019-02-08 23:28:49 +01:00
Davide Brunato 0568f2a509 Fix for issue #99
- Fixed content_type assignement in _parse_complex_content_extension:
    now it's set after base_type usage, using a local variable.
  - Same fix for method _parse_complex_content_restriction.
2019-01-30 15:28:15 +01:00
Davide Brunato ec342bef5f Add __repr__ for XsdGlobals and change it for schema classes 2019-01-29 18:51:03 +01:00
Davide Brunato 14488d06d1 Add defaultAttributes for XSD 1.1 schemas
- Added two test schema cases in features/attributes/
  - Added TestValidation11 class with a test for default attributes
2019-01-23 17:08:01 +01:00
Davide Brunato 9d6b88baae Change copyright years info 2019-01-20 16:56:10 +01:00
Davide Brunato aebbe296c2 Fix for issue #93 2018-12-24 23:27:02 +01:00