Commit Graph

48 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 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 b7b6fef418 Base modules refactoring for fix ElementTree import 2019-10-07 15:31:18 +02:00
Davide Brunato 590c7e6c41 Add intersection() to XsdWildcard
- Renamed XsdWildcard.extend() to union()
2019-09-17 16:37:16 +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 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 57e2f96337 Add unmap_prefixed() to NamespaceMapper class 2019-07-02 15:31:28 +02:00
Davide Brunato 5d04d7e68a Implementing lazy validation
- Added XMLResource.iterfind() for XPath iteration of a resource;
  - Validator API refactored: remove path argument from iter_errors()
    of components, add validate, is_valid, iter_errors to XMLSchema
    class with additional arguments path and schema_path.
  - Fix test case patterns.xml (now find also duplicated IDs)
2019-06-05 07:01:53 +02:00
Davide Brunato 037cec1848 Update NamespaceResourcesMap class
- Items are set with a copy in case of a list (real copy)
2019-03-12 07:18:17 +01:00
Davide Brunato 9d6b88baae Change copyright years info 2019-01-20 16:56:10 +01:00
Davide Brunato fd5b6c9230 Fix for issue #96 (import deprecation warning) 2018-12-23 17:48:24 +01:00
Davide Brunato 47af0bec35 Refactoring of Unicode data categories
- build_unicode_categories() replaces get_unicode_categories()
  - Added get_unicodedata_categories()
  - Removed unicode_category_sequencer()
  - Rewritten tests for Unicode categories
2018-10-15 09:00:20 +02:00
Davide Brunato bd90cacc7a QNames refactoring
- Moved all QNames to the same module
  - Create module helpers.py that includes XSD parse utils and name
    manipulation helper functions
2018-10-08 23:47:18 +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 199114699e Add single-character escapes to regex.py module
- Working on a fix for issue #79
2018-09-18 18:17:21 +02:00
Davide Brunato cac14a0821 Rewritten helper function for getting the XPath default namespaces 2018-08-08 06:39:58 +02:00
Davide Brunato a388689cc1 Complete resource API refactoring
- Set default timeout=30 to fetch_* functions
  - Use keyword arguments (**resource_options) for providing options
    for XML resource related helper functions
  - Add base_url to module level API
2018-07-11 08:58:35 +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 19aea791b6 Make etree_tostring compatible with lxml elements 2018-07-02 08:27:35 +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 633b9418c6 Fix XsdGroup.iter_encode() 2018-06-22 14:36:06 +02:00
Davide Brunato 0c72cab78f Some fixes and improvements
- Fix XsdUnion iter_decode(): consider a list of values as
    last tentative.
  - Update etree_get_namespace(): now collects all the namespaces
    of the XML data, adding new prefixes for duplicates.
2018-06-22 13:38:26 +02:00
Davide Brunato 347566af67 Fix issue #46
- XMLSchema class: changed get_converter() and iter_decode() to accept
    keyword arguments containing options for converters and decoding
  - Added a test for this issue into test_decoding.py
  - Renamed namespaces contants in namespaces.py
2018-03-08 18:19:39 +01:00
Davide Brunato 7f5ed286f3 New __repr__ for XsdComponent classes and for NamespaceView class 2018-01-21 12:13:44 +01:00
Davide Brunato c31fc194d8 Update schema class
- now parses also WSDL-SOAP original schema

  xmlschema/schema.py module:
    - more XSD compiliant imports and includes
    - added 'locations' argument to schema class init
    - improved schema location hints
    - revised documentation with more autodoc
    - schema class code cleaning
    - schema class creation is now based on a metaclass

  xmlschema/resources.py module:
    - added iter_schema_location_hints
    - fetch_schema code cleaned
    - removed old functions for retrieving XSI attributes

  xmlschema/exceptions.py module:
    - added index and expected attributes to XMLSchemaChildrenValidationError

  Updated docs using more autodocs

  Added requirements-dev.txt
2018-01-12 16:38:25 +01:00
Davide Brunato 43d0c77eee Fixed bug #34, updated copyright information. 2018-01-08 09:15:09 +01:00
Davide Brunato 094caa146e Some refactoring and bug fixes.
- Fixed issues #28 and #29
  - Code cleaning
  - Created a "validators" subpackage that includes schemas, xsd global
    maps and all the XSD components
  - Added "prefixed_name" property to XsdComponent class
2017-12-15 15:56:07 +01:00
Davide Brunato 4a8b1b7d82 Fixed some bugs:
* resources.fetch_resource function now expect a single location
  * fixed identity constraint uniqueness check
  * fixed complexContent extension
  * fixed XsdComplexType.has_simple_content method
2017-10-12 07:05:53 +02:00
Davide Brunato 6e992aab09 Fixed some bugs, code cleaning:
* Fixes for bugs #14, #15, #16
  * Removed unused module xmlschema/etree.py
  * Added tests for URLs processing (test URL normalization)
  * Updated licence information (added "-2017")
2017-09-14 13:31:02 +02:00
Davide Brunato f5f6af04e1 Completed the context selection and validation with key/unique constraints,
including the keyref.
2017-09-13 16:08:22 +02:00
Davide Brunato 17b291783e Added a module for identity constraints:
* new file: xmlschema/components/constraints.py
  * parsed xs:unique, xs:key and xs:keyref and subcomponents
  * added '|' as reference delimiter in xpath.py tokenizer
  * improved XPathParser to check operator: the base class
    admits all operators, subclasses can restricts overriding
    NOT_ALLOWED_OPERATORS class attribute.
2017-09-12 18:16:41 +02:00
Davide Brunato b86e1e96e4 Implemented other XSD 1.0 features:
* Added is_derived() to XSD types
  * Added base_type attribute to ComplexType instances
2017-07-17 10:41:57 +02:00
Davide Brunato 116e429ec5 Some bugfix and code cleaning:
* fixed a bug in simpleContent restriction parsing for attributes
  * code cleaning for schemas and resources
  * XMLSchema's 'uri' attribute changed to 'url'
  * created fetch_resource(), normalize_url() and get_xml_root() in
    resources.py, in order to start an improvement of XML parsing
2017-07-12 14:05:27 +02:00
Davide Brunato efe90cc5af Updated documentation and final checks. 2017-07-08 10:12:01 +02:00
Davide Brunato b0bad64b54 Restructured the XSD class hierarchy:
* Created a XsdBaseComponent, used both for schemas and
    for XSD components
  * ValidatorMixin replaces XMLSchemaValidator
  * XsdComponent is now the base class of all XSD components
  * new class XsdAnnotated
  * Token based checks removed (the 'built' property is pretty
    fast and safe)
2017-07-07 18:16:14 +02:00
Davide Brunato bd38d2c798 Tested with all schemas: some errors and to slow. 2017-07-04 16:14:26 +02:00
Davide Brunato 174ed7051b Move of factories's code to XSD components completed. 2017-07-03 15:30:36 +02:00
Davide Brunato 392b22f23f Fixed some bugs during meta schema build 2017-06-30 17:16:51 +02:00
Davide Brunato 64bf018b8f Modifications on factories for parsing complex restrictions. 2017-06-29 04:29:06 +02:00
Davide Brunato 5deb2f8fbe Full built and validity checks for schemas and components:
* Removed XsdGlobals.get_globals(), replaced by NamespaceView,
    a Mapping subclass that emulate a dictionary;
  * Implemented a check_status for fully checking of schema
    components, avoiding circularity;
  * Building of XSD components improved, avoiding circularity with
    the lazy building of XsdElement instances in the groups.
2017-06-28 13:23:22 +02:00
Davide Brunato f60d0052ce Modified XSD factories: now all return only an XSD component. 2017-06-27 13:16:02 +02:00
Davide Brunato b3dd07ae7f Implemented the XMLSchemaValidator base class for unifying
XMLSchema and XsdComponents with a common API.
2017-06-25 07:45:38 +02:00
Davide Brunato cf4e46f5be Implemented some converters for XML to JSON:
* Default converter (the format used by the package before)
  * Converters for JsonML, Parker, Badgerfish and Abdera conventions
  * Update of the documentation
2017-06-12 17:43:37 +02:00
Davide Brunato d304f80f6d Improved the build of XSD globals:
* global_names with dependency order from the second iteration
  * now the library builds XSD schema for tei_all.xsd
2017-05-29 15:19:03 +02:00
Davide Brunato f37c0d446a Improved XPath selection for unqualified elements:
* XsdElement.iterchildren() now considers if an XSD
    element form is 'unqualified'
  * Fixed documentation
  * Added maps.base_elements to local views
2017-05-27 09:21:37 +02:00
Davide Brunato 970fdc8975 Code cleaning before enhancements:
* Added components/ subpackage
  * Splitted components.py into more files
  * Moved facets.py to components/
2017-05-26 07:58:45 +02:00
Davide Brunato 97c5a5ff23 Added notations and substitution groups 2017-05-24 11:45:15 +02:00
Davide Brunato 2085fb1305 Added XML Schema annotations:
* Refactoring of modules for grouping QName functions and
    declarations (module xmlschema/qnames.py)
  * Created a module for namespaces declarations
    (xmlschema/namespaces.py)
  * Added a directory for model declaration tests
    (xmlschema/tests/examples/model/)
  * Added XsdAnnotation class as subclass of XsdBase
  * XsdBase class splitted and create XsdComponent class
    as the new parent class of XSD components
2017-05-23 16:45:10 +02:00