Commit Graph

38 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 d89a597c82 Update documentation and fix PEP8 errors 2019-10-11 13:44:10 +02:00
Davide Brunato b7b6fef418 Base modules refactoring for fix ElementTree import 2019-10-07 15:31:18 +02:00
Davide Brunato 7a0dbf9afc Fix other XSD 1.1 parsing errors for wilcards 2019-08-17 09:36:24 +02:00
Davide Brunato f2a30baf32 Fix XSD 1.1 bugs with W3C XML Schema suite 2019-08-01 17:16:12 +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 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 a8eebf3d15 Starting integration with W3C test suite
- Added a script for using W3C test suite with unittest
  - Started with invalid schema tests
2019-03-01 09:33:06 +01:00
Davide Brunato bbbbbe0873 Add override tag and XMLSchema11._include_schema() 2019-02-08 23:28:49 +01:00
Davide Brunato 9d6b88baae Change copyright years info 2019-01-20 16:56:10 +01:00
Davide Brunato 34c3f8a326 Added a base schema for creating XSD 1.1 list builtin types
- Set different BASE_SCHEMAS for XMLSchema10 and XMLSchema11
  - XMLSchemaMeta now uses include for XSD namespace base schemas
2018-10-30 18:15:23 +01:00
Davide Brunato 7866437f8e Add XSD 1.1 builtin types 2018-10-10 07:17:48 +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 c790838d13 Move XSD builtin QNames to qnames.py module 2018-10-08 15:32:50 +02:00
Davide Brunato 16b0b61a20 Code refactoring for XsdSingleFacet
- Created a class for each facet type
  - Use of _parse method instead of init
2018-10-04 15:55:55 +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 a9bc080ae5 Simplifying XSD components hierarchy
- Removed XsdAnnotated
  - XsdAnnotated._parse() now is owned by XsdComponent
  - XsdAnnotation _parse() method skip parent (XsdComponent) method
2018-04-05 09:28:49 +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 bfab7b31b9 Working on wildcards for introducing XSD 1.1 attributes parsing 2018-01-28 09:37:56 +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 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 17fd8eba33 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-07-22 07:20:16 +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 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 4c3add76e6 First working version for encode data to XML:
* Added ElementData namedtuple to represent Element
    decoded or encoded data.
  * Fixed a bug in qname.reference_to_qname() that mapped
    every local name to target namespace.
2017-06-15 07:59:00 +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 d6515cdaa9 Some bugfixes:
* Fixed qname.qname_to_prefixed() that maps only the first value
  * Fixed element iter_decode() for False values
  * Fixed decoding/validating tests imports
  * Added new test file examples/decoder/data2.xml
2017-05-26 22:07:53 +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
Davide Brunato af7eb7e294 Split validators.py in two files:
* XSD Facets are now in a dedicated file (facets.py)
  * renamed: xmlschema/validators.py -> xmlschema/structures.py
  * renamed: xmlschema/parse.py -> xmlschema/xsdbase.py
  * XsdBase class -> xmlschema/xsdbase.py
  * refactoring builtins and XsdAtomicType in order to
    distinguish between primitive and derived types
2016-12-23 17:08:48 +01:00
Davide Brunato 5d879e4eda Improved XSD facets:
+ Completed facets builting into factories
  + Added checks for whiteSpace facets
  + Added checks for length facets
2016-12-21 12:34:55 +01:00
Davide Brunato ef30d3daca Added classes for XSD facets:
+ XsdFacet: Base class for facets
   + XsdUniqueFacet: Class for unique instance facets
   + XsdEnumerationFacet: Class for enumerations
   + XsdPatternsFacet: Class for pattern lexical constraints
2016-12-19 15:11:01 +01:00
Davide Brunato b64bf666bd Code refactoring before completing the implementation of facet constraints:
modified:   xmlschema/__init__.py
	modified:   xmlschema/builtins.py
	modified:   xmlschema/core.py
	modified:   xmlschema/etree.py
	renamed:    xmlschema/validators.py -> xmlschema/exceptions.py
	modified:   xmlschema/factories.py
	modified:   xmlschema/parse.py
	modified:   xmlschema/qnames.py
	modified:   xmlschema/resources.py
	modified:   xmlschema/schema.py
	modified:   xmlschema/tests/test_decoding.py
	modified:   xmlschema/utils.py
	renamed:    xmlschema/components.py -> xmlschema/validators.py
2016-12-16 14:44:33 +01:00
Davide Brunato b3a3a933b9 Fixed some limitations in schemas inclusions. 2016-10-25 16:43:46 +02:00
Davide Brunato 313f41adbe Initial commit
Changes to be committed:
	new file:   .gitignore
	new file:   LICENSE
	new file:   README.rst
	new file:   setup.py
	new file:   tests/__init__.py
	new file:   tests/_test_common.py
	new file:   tests/examples/bikes.xsd
	new file:   tests/examples/cars.xsd
	new file:   tests/examples/recursive-groups.xsd
	new file:   tests/examples/testfiles
	new file:   tests/examples/types.xsd
	new file:   tests/examples/vehicles-1_error.xml
	new file:   tests/examples/vehicles-2_errors.xml
	new file:   tests/examples/vehicles-3_errors.xml
	new file:   tests/examples/vehicles-max.xsd
	new file:   tests/examples/vehicles.xml
	new file:   tests/examples/vehicles.xsd
	new file:   tests/test_decoding.py
	new file:   tests/test_schemas.py
	new file:   tests/test_validation.py
	new file:   xmlschema/__init__.py
	new file:   xmlschema/builtins.py
	new file:   xmlschema/core.py
	new file:   xmlschema/etree.py
	new file:   xmlschema/factories.py
	new file:   xmlschema/parse.py
	new file:   xmlschema/qnames.py
	new file:   xmlschema/resources.py
	new file:   xmlschema/schema.py
	new file:   xmlschema/schemas/HFP/XMLSchema-hasFacetAndProperty.xsd
	new file:   xmlschema/schemas/XML/xml.xsd
	new file:   xmlschema/schemas/XSD_1.0/XMLSchema.xsd
	new file:   xmlschema/schemas/XSD_1.0/datatypes.xsd
	new file:   xmlschema/schemas/XSD_1.1/XMLSchema.xsd
	new file:   xmlschema/schemas/XSD_1.1/datatypes.xsd
	new file:   xmlschema/schemas/XSI/XMLSchema-instance.xsd
	new file:   xmlschema/schemas/XSLT/schema-for-xslt20.xsd
	new file:   xmlschema/utils.py
	new file:   xmlschema/validators.py
2016-10-14 13:48:19 +02:00