Commit Graph

88 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 df939b9cea Fix xs:alternative and xs:keyref referefence building 2019-08-28 15:56:31 +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 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 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 7d20e8eff1 Add tests for meta-schema and add XMLSchema11 to package base
- Build meta-schema when is used for validation/decode/encode
    or the builtin-types() accessor is used
  - Add clear() method to XMLSchema base class
2019-06-27 10:48:25 +02:00
Davide Brunato 6994da5173 Code refactoring for tests
- Rename XMLSchemaTestCase to XsdValidatorTestCase
  - Add casepath() helper
  - Modify TestResources: derive from TestCase and use casepath()
  - Split test_package.py into 3 modules (added test_etree.py and
    test_memory.py)
  - Update .tox with new environments 'package' and 'memory'
  - Replace test_package with test_etree into test_all.py script
  - Modify XsdValidatorTestCase.check_schema() to use xs prefix for
    XSD namespace and no namespace as targetNamespace for a fast
    reuse of common and user sample cases
2019-06-20 15:35:04 +02:00
Davide Brunato 75e547abe5 Start development of release v1.0.13 2019-06-19 17:05:41 +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 3d5c7ee110 Start next release development
- Update release to v1.0.12
  - Add XsdDefaultOpenContent subclass
  - Fix openContent parsing in complex types
2019-05-09 11:04:50 +02:00
Davide Brunato 149a1e454f Update documentation 2019-05-05 15:08:58 +02:00
Davide Brunato 1c1dc6b60f Increase release and update documentation 2019-04-08 07:29:09 +02: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 6d192e2220 Put deprecation warnings for XMLSchema_v1_0 and etree_get_namespaces() 2019-02-03 14:08:53 +01:00
Davide Brunato 5f10fe67a7 Code cleaning of test scripts
- Removed old code of xmlschema imports
  - Test header enriched with Python version and platform
2019-01-31 22:09:18 +01:00
Davide Brunato 6646676cef Add type alternatives definitions to XSD 1.1 elements
- Fix empty content mapping in XMLSchemaConverter.map_content
2019-01-28 10:09:15 +01:00
Davide Brunato 9d6b88baae Change copyright years info 2019-01-20 16:56:10 +01:00
Davide Brunato c0e2bbdec5 Add assertion facet
- Added XsdAssertionsFacet: based on MutableSequence like XsdPatternsFacet
  - Fixed a typo in XsdPatternsFacet.__setitem__
  - Started development of release v1.0.7
2018-10-23 11:24:38 +02:00
Davide Brunato 35685c5964 Start development of release v1.0.6
- Added test slots for parse helper functions
2018-09-28 19:09:10 +02:00
Davide Brunato 717d467bc5 Start release v1.0.5 and fix for issue #82 2018-09-25 17:52:44 +02:00
Davide Brunato fe3078a3c7 Implement a new iter_decode method based on XsdModelVisitor 2018-09-08 11:19:51 +02:00
Davide Brunato 857ee59cbe Added new helper methods for validation errors generation 2018-08-11 13:09:12 +02:00
Davide Brunato 876622e9e9 Added XMLSchema11 class for development 2018-08-09 07:10:39 +02:00
Davide Brunato 07d6071db1 Remove intermediate class XsdDeclaration
- Restore old XSD class structure for emerged problems with Py34
    serialization of TEI schema
  - Started the development of release 1.0.3
2018-07-26 23:31:59 +02:00
Davide Brunato f26f7307c5 Update docs to release
- Added ElementPathMixin with autoclass
2018-07-26 17:47:00 +02:00
Davide Brunato e967aa6db8 Use pathlib for checking resource URLs 2018-07-18 11:30:13 +02:00
Davide Brunato 0af5307e6c Fix path normalization for Windows platform 2018-07-14 15:52:03 +02:00
Davide Brunato e06e5571a0 Fix resource locations processing for namespace imports
- Added copy(), __repr__ and __str__ to XMLResource class.
  - Fixed XMLResource.get_locations(): now accepts also locations
    already stored into a NamespaceResourcesMap dictionary.
  - XMLSchema.iter_decode now always creates an XMLResource from
    the source argument.
  - Fix for XMLSchema.built property: has to count all namespace globals.
2018-07-11 14:13:23 +02:00
Davide Brunato afa7299a72 Written XMLResource.get_locations() method 2018-07-10 15:02:07 +02:00
Davide Brunato dc87c4ef61 Added fetch_namespaces() to resource API
- etree_get_namespaces() removed from etree.py but left in module
    as alias of fetch_namespaces for back compatibility.
2018-07-10 12:41:39 +02:00
Davide Brunato f3c73d28ca Add allow_overrides to schema init arguments and add documents.py
- Import schemaLocation attribute can be overriden
  - Re-added the --network flag to test factory arguments to skip
    tests that fail if network access is not available
  - Code cleaning: added documents.py for all module level API
2018-07-09 10:45:06 +02:00
Davide Brunato 3e6ce18ae4 Rewritten includes and imports for schema initialization
- Now a warning message is sent to the logger for include or
    for namespace import errors
  - Add XMLSchemaImportWarning and XMLSchemaIncludeWarning
  - Add warning attribute to schemas for collecting the message
    strings about include and import warnings
  - URIDict class removed (faulty with empty fragment #)
  - Added --warning and --timeout to test factory arguments
  - Removed --network from test factory arguments
2018-07-07 11:25:00 +02:00
Davide Brunato a2ededd343 Use OrderdedDict for build lxml Element nsmap to preserve order 2018-07-01 23:59:38 +02:00
Davide Brunato de21bd83a2 Added JSON decode-encode-decode tests for each XML file test case 2018-06-29 19:50:58 +02:00
Davide Brunato 605c403891 Fix XsdElement.iter()
- Avoid circularities cases using a list buffer at each level (safe mode)
  - Added XMLSchema.root_elements lazy property
  - Removed XMLSchema.base_elements
2018-06-29 18:13:45 +02:00
Davide Brunato acefbeb298 Add XML encoding tests with lxml's Element class 2018-06-28 19:10:25 +02:00
Davide Brunato a3035f960f Add XsdAnyAttribute.iter_encode()
- Added tests for JSON serialization with all converters
  - Fix for attribute decoding/encoding: now in case of XsdAnyAttribute
    the value is reassigned with (name, value) instead of {name: value}
  - Fixed a typo for to_dict() module API
2018-06-28 15:41:57 +02:00
Davide Brunato 49e8b22869 Added JSON serialization functions at module level
- Updated and revised documentation
  - Code cleaning (iter_encode and iter_decode args)
  - to_json() and from_json() module functions
  - New tests for module level API
2018-06-28 13:52:21 +02:00
Davide Brunato 7d006d670d Update changelog with release dates and code cleaning 2018-06-27 16:29:59 +02:00
Davide Brunato 4128f21548 Improve converters and namespace decoding
- Fixed NamespaceMapper base class
  - Added level=0 argument to XMLSchemaConverter.element_decode()
2018-06-27 15:06:14 +02:00
Davide Brunato 7d9a2245f6 Full metaclass implementation for schemas
- create_validator() helper function removed
  - added add_metaclass decorator (from six)
  - XMLSchemaBase now has XMLSchemaMeta as metaclass
2018-06-18 17:24:14 +02:00
Davide Brunato fb24068ebe Fix schema serialization and update version
- Modified CHANGELOG.rst
  - Lookup functions rewritten and bound to global names for serialization
  - Dependancy: elementpath minimal version now is 1.0.10
2018-06-15 18:39:52 +02:00
Davide Brunato a3ca8bba9d Switch to new release 0.9.30
- Fix for issue #66
  - Schema tests cleaning (moving some tests to test_schemas.py script)
  - Removing some old test files
2018-06-06 14:11:39 +02:00
Davide Brunato 9429759f98 Modify tests and test scripts
- cases/features/decoding/ renamed to cases/features/decoder/
  - decoder/decoder.xsd renamed to decoder/simple-types.xsd
  - Use namespace xmlns:xst="http://xmlschema.test/test/" for all
    cases/features tests
  - Added XMLSchemaTestCase base class for tests/ subpackage
  - Wrote a get_testfiles() functions for tests/ subpackage in order
    to reduce redundant code in other test scripts
  - Added tests for encoding of simpleType's lists
2018-05-20 07:38:15 +02:00
Davide Brunato 22808a61dc Add test_encoding.py module and fix test_package.py
- Fix test for version that didn't match package_dir
2018-05-09 07:04:26 +02:00
Davide Brunato a3c6a66a62 Fix bug #58 and start integrating defusedxml library
Bug #58:
  - Added a file for test circular model detection

Integrating defusedxml:
  - defusedxml.ElementTree API loaded in etree.py
  - safe load with defusedxml only for network resources
2018-04-26 13:08:56 +02:00
Davide Brunato e9dcdb3f1e Implement model restriction checks
Added methods:

  - ParticleMixin.is_restriction()
  - XsdGroup.is_restriction()
  - XsdGroup.iter_group()
  - XsdElement.is_restriction()
2018-04-10 11:10:48 +02:00
Davide Brunato c0a66696be Switch to release 0.9.25
- Fixed doctest error (relative wrong XPath path)
  - Added test for issue #56
  - Version updated
2018-04-05 14:02:04 +02:00
Davide Brunato e1159ac08d Add test for issue #53 and tox.ini
- The XPath pipe operator is parsed by the 'elementpath' package
  - Configured tox.ini using the test_all.py as command
  - Removed exception class XMLSchemaXPathError
2018-03-29 19:24:05 +02:00
Davide Brunato fa796d2dcf Complete xpath module substitution, improve testing
- With elementpath-1.0.4 pass all tests
  - Check version alignment with test_package.py
2018-03-27 19:47:56 +02:00