Commit Graph

142 Commits

Author SHA1 Message Date
Davide Brunato 249e555659 Improve content model encoding
- Update iter_collapsed_content() to perform a model conforming
    reordering.
2019-10-13 21:42:41 +02:00
Davide Brunato de7e2343bd Implement element substitution and xsi:type block in instances 2019-10-12 22:59:54 +02:00
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 b6c6e2ac8f Change get_context() in document module
- Now the optional schema argument is a fallbak in case
    the schema path is not found into XML resource.
2019-09-23 17:29:08 +02:00
Davide Brunato 8d56d128ca Add XSD 1.1 inheritable check on XML instance validation
- Add substitutes to dynamic checks
2019-09-23 09:26:31 +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 a4b1d8896b Add 'restriction' attribute to XsdGroup for simplify dynamic EDC checks 2019-09-13 07:32:57 +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 c530fda102 Fix openContent validation ad regex character group parsing
- Put interleave mode after model match for precedence
  - Fix regex parsing of character group ending with '-'
  - Fix complexType mixed content extension
2019-09-06 06:42:34 +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 1c0e18b648 Fix XSD 1.1 xs:all group restriction
- Added an additional fallback check for xs:choice groups in
    Xsd11Group.is_all_restriction()
  - Fixed tests for wildcards and updated the W3C test script with
    total counters displayed before run
2019-08-26 11:01:41 +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 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 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 7ef629e6c3 Add xs:all restriction checking for XSD 1.1 2019-08-12 18:23:43 +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 13950ad958 Fix element matching in XsdGroup.iter_encode() 2019-08-05 21:53:30 +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 3d38e87d2e Clean iter_decode and iter_encode arguments for XSD components 2019-08-02 16:19:55 +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 35089f9354 Add tests for XSD any wildcards
- Update docs with XSD 1.1 validator support
  - Fix: XsdAnyElement substituted with BUILDERS.any_element_class
    in shared 1.0/1.1 code
2019-07-13 09:47:59 +02:00
Davide Brunato 759de2ee0e Clean encoding tests and fix converter instance creation
- Removed additional test classes added with PR #117;
  - Removed additional converter argument from the calls of the
    method get_converter(), that causes errors when the argument
    'converter' is provided but not with an instance.
2019-07-11 10:47:02 +02:00
Davide Brunato 87cc74fc44 Added unordered and collapsed encoding modes
- Keep UnorderedConverter class as the default converter for
    encoding unordered data
  - Added 'unordered=False' option to iter_encode's arguments
  - Added iter_unordered_content() and iter_collapsed_content()
    to ModelVisitor class
2019-07-11 09:43:12 +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 5a5a0f6d47 Merge branch 'master' of github.com:sissaschool/xmlschema into develop 2019-07-03 06:51:49 +02:00
Daniel Hillier 9455216eaa Rename VisitorConverter and related code
Rename VisitorConverter to UnorderedConverter and other related small
tidy ups.
Remove VisitorConverter from package's __init__.py
2019-07-02 22:58:45 +10:00
Daniel Hillier 6bee8769d5 Split encoding of unordered content between converter and validators.groups
This makes the process of turning a dictionary of unordered element
content into ordered elements available to other converters.
2019-07-02 11:11:32 +10:00
Daniel Hillier 4ecfcca66d Raise error when encoding group overflows and validation="strict" 2019-06-29 01:03:18 +10: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 d3775dad0e Remove attribute 'broken' from ModelVisitor
- Attribute replaced by a local variable in XsdGroup.iter_decode()
2019-06-23 08:49:16 +02:00
Davide Brunato 0018e38d85 Add experimental full lazy validation
- Full lazy validation for XMLSchema.validate() and iter_errors(),
    passing lazy=True and no path.
2019-06-19 10:06:01 +02:00
Davide Brunato 788135c4c5 Update document APIs
- Added arguments for building XMLResource from xml_document
2019-06-13 16:22:48 +02:00
Davide Brunato fe521dcaf4 Uniformating iter_decode/iter_encode arguments for XSD components
- Move optional argument 'converter' to keyword arguments
  - Adjust filler parameter usage in XsdAttributeGroup.iter_decode
2019-06-08 09:43:15 +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 3f470927b8 Code cleaning and package dependencies update 2019-05-05 15:13:40 +02:00
Davide Brunato 22dbd7256c Add XsdList.is_derived() and XSD 1.0 invalid rule to choice restriction 2019-04-29 22:43:41 +02:00
Davide Brunato c4385f4559 Fixes for bad schemas checks 2019-04-27 19:41:26 +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