Commit Graph

604 Commits

Author SHA1 Message Date
Davide Brunato 92de835afa Fix defaultOpenContent and defaultAttributes parsing 2019-11-18 09:16:01 +01:00
Davide Brunato a60532a3ab Fix sequence model stop criteria 2019-11-15 17:49:46 +01:00
Davide Brunato 8207284c5a Clean models.py module from unused code 2019-11-15 09:25:04 +01:00
Davide Brunato fc3141283d Fix some W3C failed tests
- fix inherited attrs composition in XSD elements
  - check single ID for element's attributes validation
2019-11-14 18:44:31 +01:00
Davide Brunato 79cf89af86 Fix ambiguous choice models visiting
- Fixed registering max occurs for tuple (group,)
  - TODO: maybe the same solution for 1-length sequence groups
2019-11-14 11:18:11 +01:00
Davide Brunato 7c4cd8b4d3 Change stop_item() in ModelVisitor.advance()
- Removed ParticleMixin.min_occurs_reps()
  - Removed ModelGroup.group_occurs()
2019-11-08 16:40:02 +01:00
Davide Brunato 2bcf78549c Add count_occurs() to ModelGroup 2019-11-08 07:17:29 +01:00
Davide Brunato d0f3a0f6c8 Skip ElementTree import test with external process on Windows platform 2019-11-06 11:49:09 +01:00
Davide Brunato b8ccfac6f1 Update test_resources avoiding usage of unapplicable 'file' scheme 2019-11-06 11:40:51 +01:00
Davide Brunato dc82f04874 Filter normalize_url result 2019-11-06 10:39:51 +01:00
Davide Brunato 24a08c4442 Add replacing of backslashes from normalize_path result 2019-11-06 10:22:09 +01:00
Davide Brunato 896982222f Fix Windows paths normalization 2019-11-06 09:49:00 +01:00
Davide Brunato dd2ab72654 Add iter_group() to ModelVisitor 2019-11-05 11:09:34 +01:00
Davide Brunato b95d890f51 Refine 'all' models visiting
- Restart at every match with not exhausted items
  - Do not check occurs on stop_item()
  - Do not reset element counter when repeat
2019-10-31 16:20:10 +01:00
Davide Brunato 4c624af6c9 Fix name matching and targetNamespace for XSD 1.1 declarations
- Use the targetNamespace of reference
  - In case of a default namespace try also the match with the local name
2019-10-30 18:05:41 +01:00
Davide Brunato 2b1497860b Fix 'all' model groups visiting
- Also at each match the group element is changed (TODO: check if
    it's better to restart like choice groups)
  - In XSD 1.1 __iter__ now yields wildcards at the end for 'all'
    and 'choice' model groups
2019-10-30 07:13:47 +01:00
Davide Brunato 732864edc7 Fix xs:ID counting for nodes without parent
- Consider attributes with level+1 as child elements
  - Clean XsdAtomicBuiltin.iter_decode() method
2019-10-28 12:31:10 +01:00
Davide Brunato c963970549 Fix openContent's appliesToEmpty attribute use 2019-10-25 23:02:13 +02:00
Davide Brunato ded91458a1 Extend schema validation to match every defined global element
- Should be a fix for issue #140
2019-10-25 10:28:42 +02:00
Davide Brunato df6eb23516 Add XML data depth limits
- Add module xmlschema.limits for store processing limits
  - Add max_depth optional argument to decode methods
  - Code cleaning for iter_decode() kwargs (elements and groups)
2019-10-25 06:35:15 +02:00
Davide Brunato a374d15805 Fix resource tests for Python 2 2019-10-24 06:37:31 +02:00
Davide Brunato 6942be8ac9 Optimize qname_to_prefixed() and get_namespace() helpers
- use_empty optional argument added to qname_to_prefixed()
2019-10-23 09:47:49 +02:00
Davide Brunato c075ff22e5 Complete the revision of resource module
- normalize_url() now processes file names containing '#' chars
  - Fix iterfind() of lazy resource
  - Add more tests for XML resources
2019-10-22 18:37:26 +02:00
Davide Brunato 8db83477df Extend check_memory.py script
- Add an argument to repeat test N times
  - Add matplotlib to dev requirements
2019-10-22 14:28:46 +02:00
Davide Brunato 8dd5d193ba Update XML resource iterfind() to fix issues #102 and #112
- Speed up admitting simple paths and checking only elements
    that match path level
  - Avoid selection for * paths (about 35% faster)
  - Add close() method to XmlResource
2019-10-21 06:57:02 +02:00
Davide Brunato 43322b6bc0 Refactor XmlResource after merge
- Remove _document and _fid (use the attribute source instead)
2019-10-19 00:08:09 +02:00
Davide Brunato 2ed0212002 Add option -n/--narrow to tests for skipping extra checks 2019-10-19 00:04:28 +02:00
Davide Brunato 9443adf396 Merge branch 'master' of github.com:sissaschool/xmlschema into develop 2019-10-17 10:42:04 +02:00
Davide Brunato 54060ba0df Modify resources.fetch_schema_locations()
- Now can returns location for another namespace if hints for
    resource namespace are missing
2019-10-16 21:14:15 +02:00
Davide Brunato 7d0d251837
Merge branch 'master' into b121 2019-10-16 18:11:49 +02:00
Davide Brunato 248b9f9b68 Update XSD validation with wildcards
- Add load_namespace() to XsdGlobals
  . Modify iter_decode/iter_encode for xs:any and xs:anyAttribute
2019-10-16 15:22:49 +02:00
Davide Brunato 8407f09139 Add LOCATION_HINTS dict to namespaces module
- Use LOCATION_HINTS for schema's fallback locations
2019-10-16 06:45:53 +02:00
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 22fdcc9a5a Fix etree_to_string to avoid registering reserved prefixes 2019-10-12 11:23:31 +02:00
Davide Brunato d89a597c82 Update documentation and fix PEP8 errors 2019-10-11 13:44:10 +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 997c59c837 Fix locations argument usage
- Used to import other namespaces explicitly (as disposed by
    "xsi:schemaLocation" in an XML instance).
  - It's not propagated to included/imported schemas anymore.
2019-10-10 20:35:45 +02:00
Davide Brunato 588f17a1f9 Fix xs:error type decoding/encoding 2019-10-10 20:34:40 +02:00
Davide Brunato 1a06be7477 Fix the parse of keyref's refer to skip key references 2019-10-10 14:21:55 +02:00
Davide Brunato 9146d94d43 Fix assertion value for schema context analisys 2019-10-10 14:20:58 +02:00
Davide Brunato 922a43da21 Fix for unbound multi-schema W3C tests 2019-10-10 14:14:55 +02:00
Davide Brunato 75664150e6 Improve XPath bindings
- Extend ElementPathMixin with instance _xpath_parser
  - Add xpath_tokens dictionary to schema objects
  - Fix serialization removing xpath_tokens classes
2019-10-09 15:03:50 +02:00
Davide Brunato 690a172502 Add logging for schema initialization and building
- Add loglevel argument to schema init
  - Fallback location (for XLink and XHTML) moved at the
    end of import tentatives (full fix for issue #137)
  - Fix TestGlobalMaps after the remove of XLink from base schemas
2019-10-08 11:30:36 +02:00
Davide Brunato 433970cf72 Add FALLBACK_LOCATIONS to schema class
- XLink namespace removed from base schemas
  - Fallback locations dictionary added for XLink
    and XHTML namespaces
  - Fix for issue #137 (local mode)
2019-10-07 22:18:08 +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 9afff86ee9 Remove validators and patterns checks for XsdList/XsdUnion
- The base XsdList and XsdUnion types have no validators or patterns,
    that are added only to restrictions.
  - Added patterns optional argument to XsdUnion.iter_decode(): derived
    types pass our patterns to the xs:union base type, that checks them
    after normalization with the selected member type.
2019-10-03 07:13:56 +02:00
Davide Brunato 844ddec3ba Fix assertions
- Add custom parser for assertion facet (without position() and last()).
  - Move parser initialization to XsdAssert.parse_xpath_test() because
    all the components must be defined.
2019-10-01 06:44:31 +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