Commit Graph

700 Commits

Author SHA1 Message Date
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 60663ef74b
Merge pull request #122 from danifus/b121
B121
2019-10-17 10:04:20 +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 285b5e3b5b Update to release v1.0.15 2019-10-13 22:12:57 +02:00
Davide Brunato 298ceb117a Merge branch 'develop' for upgrade to v1.0.15 2019-10-13 22:11:58 +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
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 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 23390a1ed7 Fix xs:keyref ref building and add count_digits() helper 2019-09-20 11:49:01 +02:00
Davide Brunato a95dfe26fe Add is_list() to XsdSimpleType and fix xs:QName length facets 2019-09-19 19:00:05 +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 e4d9941eb3 Fix wildcard restriction checking in case of notQName 2019-09-18 10:52:48 +02:00
Davide Brunato 7b696fbabb Fix wildcard union and add tests for wildcard intersection 2019-09-18 09:41:01 +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 c35f86d681 Add IDREF checking and fix ID collecting
- ID are not counted for XML document root
  - IDREF checked with adding a key with 0 value if missing
    (TODO: Add a validation error instance or a reference)
2019-09-06 11:37:30 +02:00
Davide Brunato c36ef4a26a Copy identities dict for element references 2019-09-06 08:46:02 +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 33b6db54e9 Refactoring of ModelVisitor and Xsd11AnyElement
- Modify ModelVisitor for using XSD 1.1 xs:all groups
  - Remove inverted list from _subgroups item
  - Use occurs to store sum of xs:all items
  - Add precedences to Xsd11AnyElement for managing cases of
    overlapping wildcard (overlap with an adjacent element
    that also matches an item).
2019-09-04 10:53:59 +02:00
Davide Brunato f5afa915fc Expand model tests with XMLSchema11 class 2019-08-31 07:22:44 +02:00
Davide Brunato 1589f34468
Merge pull request #130 from libremente/master
Fix MIME type
2019-08-28 16:58:01 +02:00
Davide Brunato df939b9cea Fix xs:alternative and xs:keyref referefence building 2019-08-28 15:56:31 +02:00