Commit Graph

101 Commits

Author SHA1 Message Date
Davide Brunato 436567a8ad Fix documentation sections 2019-11-18 10:21:40 +01: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 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 d89a597c82 Update documentation and fix PEP8 errors 2019-10-11 13:44:10 +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 df939b9cea Fix xs:alternative and xs:keyref referefence building 2019-08-28 15:56:31 +02:00
Davide Brunato 7b5a2b9d6d Removed unmap_prefixed() from NamespaceMapper
- Added an optional name table to unmap_qname() for the lookup
    of local names
  - Fix lxml encoding tests in case of default namespace
2019-08-27 10:58:32 +02:00
Davide Brunato 97b5203ba6 Update documentation 2019-08-26 11:30:25 +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 74a45b9010 Refactoring test scripts
- Created test_factory subpackage
  - Avoid test discovery duplications
  - Added tests into test_cases dir for default discover
  - Grouped validation and validators tests in two dirs
2019-08-17 17:47:19 +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 5a5a0f6d47 Merge branch 'master' of github.com:sissaschool/xmlschema into develop 2019-07-03 06:51:49 +02:00
Davide Brunato 1f3a72a2c8 Code cleaning for converter classes
- Add lossy property as a replace for lossless (not lossy)
  - replace _unmap_attribute_qname() with unmap_prefixed()
  - Add deprecation warnings for old methods
2019-07-02 15:46:59 +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 a15cb1dc11 Add VisitorConverter: uses visitor model for encoding
- Resolves #69
  This approach allows strict encoding and validation of an unordered
  dictionary without having to handle errors.
- Can generate correct xml for repeated sequences of multiple elements:
  {"A": [1, 2], "B": [3, 4]} -> <A>1</A><B>3</B><A>2</A><B>4</B>
- VisitorConverter raises an Exception if the data being encoded
  contains cdata. The unordered processing of the dict means character
  data may not be placed in the correct locations.
- Reuses existing encoding tests.
2019-07-02 10:59:39 +10: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 674f14c3ff Update docs and CHANGELOG.rst 2019-06-19 10:35:13 +02:00
Davide Brunato 69405e662c Add info for building custom converters to docs (issue #109) 2019-06-14 09:07:05 +02:00
Davide Brunato 7045b01e4b Add a script for testing XSD and XML files directly 2019-05-13 08:55:10 +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 e6d8b4cf55 Add XMLSchemaModelError exception 2019-03-29 16:22:16 +01:00
Davide Brunato 5917873b7f Add resolve_qname() to XMLSchemaBase
- Replace prefixed_to_qname() with resolve_qname()
  - Code cleaning for helpers.py module
  - Add schema defaults as XMLSchemaBase class attributes
2019-03-14 15:18:28 +01:00
Davide Brunato 4dc7714a18 Update documentation and requirements 2019-02-25 14:44:28 +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 19cde9ec39 Update documentation 2019-02-02 23:16:45 +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 2eabc190fe Replace defusedxml dependency
- The defusedxml seems to be unmaintained and has some problems
    with the ElementTree loading
  - Replaced by a safe XMLParser that forbids entities processing
2019-01-22 17:50:13 +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 191d7630de Update CHANGELOG and add tests for imports
- Tests for lazy import of defusedxml library for mitigate the issue #80
  - Added versioning links to CHANGELOG
  - Removed test_etree.py (tests added to test_package.py)
2018-09-22 23:25:59 +02:00
Davide Brunato 8e8f53ecb9 Update validator exceptions and test modules
- Add test_helpers.py module
  - Refactoring of chidren validation error's reason build
  - Removed unused qname helper functions (split_*)
  - Fix case collection missing files (logger.error message)
2018-09-15 16:56:43 +02:00
Davide Brunato fe3078a3c7 Implement a new iter_decode method based on XsdModelVisitor 2018-09-08 11:19:51 +02:00
Davide Brunato 6326381cd7 Update documentation and add a deprecation warning for XMLSchema.parent_map 2018-08-27 17:32:26 +02:00
Davide Brunato 96cb4b57af Refactoring of error and to etree_tostring serialization
- Added namespaces argument to etree_tostring helper method.
  - Refactored validator error string representation.
  - Moved namespaces argument at last position for methods validate
    and iter_errors of class ValidationMixin.
  - Fixed document validate API and added tests for it
2018-08-27 15:43:19 +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 3f8d56070d Create XsdDeclaration class as XsdComponent subclass
- Unify code for XSD declarations, that are the components that are
     referenciable (elements, attributes, groups and attribute groups)
2018-07-26 15:19:26 +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 80c200f651 Add is_etree_element helper function
- This is a more safer test for Element objects for this package, because it
    also checks that the argument is not an instance of ElementPathMixin class
  - Add tests for fetch_schema_locations and load_xml_resource functions
2018-07-13 22:40:35 +02:00
Davide Brunato dd43288abd Update test case parser for release
- "--defaults" option removed (cases merged within --skip)
  - "--baseurl" removed (useless, the cases are all URL-based)
2018-07-12 17:32:36 +02:00
Davide Brunato 297b30e567 Update documentation and small fixes for new arguments
- Add XMLResource to docs
  - XMLSchemaConverter: default of etree_element_class set to None
2018-07-12 14:51:28 +02:00
Davide Brunato 1ee9d88c01 Fix decoder tests
- Update converters (level optional parameter also for iter_decode)
  - Update tests for decoder
  - Update namespace decoding
  - Update doctest
2018-07-03 13:32:45 +02:00