Commit Graph

113 Commits

Author SHA1 Message Date
Davide Brunato de7e2343bd Implement element substitution and xsi:type block in instances 2019-10-12 22:59:54 +02:00
Davide Brunato a79a5583ae Fix datetime types validation on encoding
- Add is_datetime() to XSD types classes
2019-10-11 13:26:17 +02:00
Davide Brunato b7b6fef418 Base modules refactoring for fix ElementTree import 2019-10-07 15:31:18 +02:00
Davide Brunato b1663c5550 Add root_type property to XsdType
- Atomic's property primitive_type transformed to attribute
  - Optimized base_type assignement
2019-09-21 10:47:11 +02:00
Davide Brunato 0480e4bee8 Add is_override() to XsdComponent for XSD 1.1 schemas
- Change is_global() from property to function
2019-09-19 06:37:42 +02:00
Davide Brunato 590c7e6c41 Add intersection() to XsdWildcard
- Renamed XsdWildcard.extend() to union()
2019-09-17 16:37:16 +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 4f5c819d0f Fix XSD 1.1 wildcard matching
- Add option occurs to is_matching() method
  - Create a custom match() method with additional option resolve
  - Replace matched_element() with match(name, resolve=True)
2019-09-05 07:06:48 +02:00
Davide Brunato e6fe1675c2 Fix fixed value check and model visiting with empty inner groups
- Added text_value() to XsdSimpleType and XsdComplexType for
    getting decoded text value for elements and attributes.
2019-08-26 08:10:58 +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 a6ef42d926 Fix model checking
- Do not check same elements (pe is e)
  - distinguishable_paths() now checks also intermediate xs:choice
    and xs:all groups
2019-08-23 08:43:41 +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 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 3d33424541 Refactor and clean reference and name attributes parsing
- Add an helper method _parse_reference()
  - Removed ref property, replaced by attribute
2019-07-29 16:01:48 +02:00
Davide Brunato 035be87572 Complete XSD 1.1 wildcards (xs:any and xs:anyAttribute) 2019-07-23 16:02:17 +02:00
Davide Brunato 40d0207968 Clean element matching
- Added custom is_matching() and match() for XsdElement
  - Removed custom match() for XsdAnyElement and XsdAnyAttribute
  - Added matched_element() to XsdAnyElement
  - Added matched_element() to XsdElement as match() alias
  - Removed iter_elements() from XsdGroup (do not iter substitutes)
  - Removed iter_subelement() from ModelGroup (use iter_elements)
  - Clean converter code on some element_encode() implementations
2019-07-08 09:37:29 +02:00
Davide Brunato 281a426ec4 Code optimization on parse helpers
- Remove iter_xsd_components() and has_hsd_components() helpers
    replaced by filter() and any() calls
2019-06-26 07:27:18 +02:00
Davide Brunato 061d72c5c6 Update decode/encode methods for schemas
- Split decode()/encode() for components and for schemas
  - Removed to_dict and to_etree for XSD components
  - Updated fetch_schema_locations() to build XMLResource instance
2019-06-18 17:20:13 +02:00
Davide Brunato bed3888e5b Fix validator exceptions with lazy resource 2019-06-05 08:15:04 +02:00
Davide Brunato 5d04d7e68a Implementing lazy validation
- Added XMLResource.iterfind() for XPath iteration of a resource;
  - Validator API refactored: remove path argument from iter_errors()
    of components, add validate, is_valid, iter_errors to XMLSchema
    class with additional arguments path and schema_path.
  - Fix test case patterns.xml (now find also duplicated IDs)
2019-06-05 07:01:53 +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 b221fa255f Bugfix for attributes and attribute groups 2019-03-27 11:59:22 +01:00
Davide Brunato f96ca2c41c Add XsdGroup.get_groups()
- Fix model checking adding a method to retrieve groups path
    for elements/particles
2019-03-25 07:30:41 +01:00
Davide Brunato b434721a93 Fix deterministic model cheching 2019-03-23 22:50:59 +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 c9baf730a5 Integrate W3C tests for invalid schemas
- Fix XsdType.is_derived(other, derivation=None) when the 2nd argument
    is provided (eg. 'extension')
  - Fix XMLSchemaBase._import_namespaces(): set namespace='' in case of
    no namespace and check that it's different from self.target_namespace.
2019-03-19 13:08:14 +01:00
Davide Brunato b01a8579d2 Complete W3C tests with valid schemas for XSD 1.0
- Added XsdElement.get_path()
  - Fixes for XSD types, identities and pattern facets
2019-03-19 10:58:12 +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 326ea24785 Rewrite XSD derivation properties and attributes 2019-03-02 23:32:11 +01:00
Davide Brunato a8eebf3d15 Starting integration with W3C test suite
- Added a script for using W3C test suite with unittest
  - Started with invalid schema tests
2019-03-01 09:33:06 +01:00
Davide Brunato ccfaab9479 Fix XML resource defusing
- Add XMLResource.defusing() for checking XML data
  - Now in XMLResource.parse() and fromsource() the SafeXMLParser is
    used only for defusing data
2019-02-25 13:34:52 +01:00
Davide Brunato 878a1815db Add _parse_xpath_default_namespace() to XsdComponent
- Removed get_xpath_default_namespace() helper and its tests
  - Removed xpath_default_namespace property from XsdComponent
2019-02-23 12:45:44 +01:00
Davide Brunato 13a5f5371c Parse of XSD 1.1 targetNamespace of elements and attributes
- Added XsdComponent._parse_target_namespace()
2019-02-07 23:10:31 +01:00
Davide Brunato 074e42c9d1 Closing the release v1.0.8 2019-01-30 18:02:35 +01:00
Davide Brunato 7cca3d386d Fix validator exceptions classes 2019-01-26 11:03:15 +01:00