diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de80fa5c..9aac4e5d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,12 @@ CHANGELOG ********* +`v1.6.0`_ (2021-04-06) +====================== +* XML data bindings and code generators are now considered stable +* Add arguments 'max_depth' and 'extra_validator' to validation methods +* Enhance decoding with 'value_hook' argument + `v1.5.3`_ (2021-03-14) ====================== * Remove unnecessary bindings with schema proxy from ElementPathMixin @@ -423,3 +429,4 @@ v0.9.6 (2017-05-05) .. _v1.5.1: https://github.com/brunato/xmlschema/compare/v1.5.0...v1.5.1 .. _v1.5.2: https://github.com/brunato/xmlschema/compare/v1.5.1...v1.5.2 .. _v1.5.3: https://github.com/brunato/xmlschema/compare/v1.5.2...v1.5.3 +.. _v1.6.0: https://github.com/brunato/xmlschema/compare/v1.5.3...v1.6.0 diff --git a/README.rst b/README.rst index e395a0b3..02a5b00c 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ This library includes the following features: * Support of XSD validation modes *strict*/*lax*/*skip* * Remote attacks protection by default using an XMLParser that forbids entities * XML data bindings based on DataElement class -* Static code generation with Jinja2 templates (experimental) +* Static code generation with Jinja2 templates Installation diff --git a/doc/api.rst b/doc/api.rst index 5a705bf4..86b59744 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -69,6 +69,8 @@ Schema level API .. autoattribute:: no_namespace_schema_location .. autoattribute:: target_prefix .. autoattribute:: default_namespace + .. autoattribute:: name + .. autoattribute:: url .. autoattribute:: base_url .. autoattribute:: root_elements .. autoattribute:: simple_types @@ -186,8 +188,10 @@ XML resources API .. autoattribute:: root .. autoattribute:: text + .. autoattribute:: name .. autoattribute:: url .. autoattribute:: base_url + .. autoattribute:: filepath .. autoattribute:: namespace .. automethod:: parse diff --git a/doc/extras.rst b/doc/extras.rst index 9a59fdf6..118a57fd 100644 --- a/doc/extras.rst +++ b/doc/extras.rst @@ -23,8 +23,8 @@ impact on the base configuration. .. _code-generators: -Code generation with Jinja2 templates (experimental) -==================================================== +Code generation with Jinja2 templates +===================================== The module *xmlschema.extras.codegen* provides an abstract base class :class:`AbstractGenerator` for generate source code from parsed XSD @@ -32,9 +32,6 @@ schemas. The Jinja2 engine is embedded in that class and empowered with a set of custom filters and tests for accessing to defined XSD schema components. -.. note:: - This extra feature is still in experimental stage. - Schema based filters -------------------- diff --git a/publiccode.yml b/publiccode.yml index d4ab9d87..89934036 100644 --- a/publiccode.yml +++ b/publiccode.yml @@ -6,7 +6,7 @@ publiccodeYmlVersion: '0.2' name: xmlschema url: 'https://github.com/sissaschool/xmlschema' landingURL: 'https://github.com/sissaschool/xmlschema' -releaseDate: '2021-03-xx' +releaseDate: '2021-04-06' softwareVersion: v1.6.0 developmentStatus: stable platforms: diff --git a/xmlschema/resources.py b/xmlschema/resources.py index 7b01d4ac..92cf295a 100644 --- a/xmlschema/resources.py +++ b/xmlschema/resources.py @@ -408,10 +408,17 @@ def text(self): """The XML text source, `None` if it's not available.""" return self._text + @property + def name(self): + """ + The source name, is `None` if the instance is created from an Element or a string. + """ + return os.path.basename(self._url) if self.url else None + @property def url(self): """ - The source URL, `None` if the instance is created from an Element tree or from a string. + The source URL, `None` if the instance is created from an Element or a string. """ return self._url @@ -423,17 +430,13 @@ def base_url(self): @property def filepath(self): """ - The source filepath if the intance is created from a local file, `None` otherwise. + The resource filepath if the intance is created from a local file, `None` otherwise. """ if self._url: url_parts = urlsplit(self._url) if url_parts.scheme in ('', 'file'): return url_parts.path - @property - def name(self): - return os.path.basename(self._url) if self.url else None - @property def allow(self): """The security mode for accessing resource locations.""" diff --git a/xmlschema/validators/schema.py b/xmlschema/validators/schema.py index 7ae96e0a..1b19d42b 100644 --- a/xmlschema/validators/schema.py +++ b/xmlschema/validators/schema.py @@ -506,10 +506,6 @@ def __reversed__(self): def __len__(self): return len(self.elements) - @property - def name(self): - return os.path.basename(self.url) if self.url else None - @property def xpath_proxy(self): return XMLSchemaProxy(self) @@ -529,9 +525,14 @@ def get_text(self): """Returns the source text of the XSD schema.""" return self.source.get_text() + @property + def name(self): + """Schema resource name, is `None` if the schema is built from an Element or a string.""" + return self.source.name + @property def url(self): - """Schema resource URL, is `None` if the schema is built from a string.""" + """Schema resource URL, is `None` if the schema is built from an Element or a string.""" return self.source.url @property