Update documentation and fix PEP8 errors

This commit is contained in:
Davide Brunato 2019-10-11 13:44:10 +02:00
parent a79a5583ae
commit d89a597c82
8 changed files with 26 additions and 17 deletions

View File

@ -2,6 +2,13 @@
CHANGELOG
*********
`v1.0.15`_ (2019-10-11)
=======================
* Improved XPath 2.0 bindings
* Added logging for schema initialization and building
* Removed XLink namespace from meta-schema (loaded from a fallback location like XHTML)
* Fixed half of failed W3C instance tests (remain 266 over 15344 tests)
`v1.0.14`_ (2019-08-27)
=======================
* Added XSD 1.1 validator with class *XMLSchema11*
@ -256,3 +263,4 @@ v0.9.6 (2017-05-05)
.. _v1.0.11: https://github.com/brunato/xmlschema/compare/v1.0.10...v1.0.11
.. _v1.0.13: https://github.com/brunato/xmlschema/compare/v1.0.11...v1.0.13
.. _v1.0.14: https://github.com/brunato/xmlschema/compare/v1.0.13...v1.0.14
.. _v1.0.15: https://github.com/brunato/xmlschema/compare/v1.0.14...v1.0.15

View File

@ -103,21 +103,21 @@ The global maps can be accessed through :attr:`XMLSchema.maps` attribute:
>>> from pprint import pprint
>>> pprint(sorted(schema.maps.types.keys())[:5])
['{http://example.com/vehicles}vehicleType',
'{http://www.w3.org/1999/xlink}actuateType',
'{http://www.w3.org/1999/xlink}arcType',
'{http://www.w3.org/1999/xlink}arcroleType',
'{http://www.w3.org/1999/xlink}extended']
'{http://www.w3.org/2001/XMLSchema}ENTITIES',
'{http://www.w3.org/2001/XMLSchema}ENTITY',
'{http://www.w3.org/2001/XMLSchema}ID',
'{http://www.w3.org/2001/XMLSchema}IDREF']
>>> pprint(sorted(schema.maps.elements.keys())[:10])
['{http://example.com/vehicles}bikes',
'{http://example.com/vehicles}cars',
'{http://example.com/vehicles}vehicles',
'{http://www.w3.org/1999/xlink}arc',
'{http://www.w3.org/1999/xlink}locator',
'{http://www.w3.org/1999/xlink}resource',
'{http://www.w3.org/1999/xlink}title',
'{http://www.w3.org/2001/XMLSchema}all',
'{http://www.w3.org/2001/XMLSchema}annotation',
'{http://www.w3.org/2001/XMLSchema}any']
'{http://www.w3.org/2001/XMLSchema}any',
'{http://www.w3.org/2001/XMLSchema}anyAttribute',
'{http://www.w3.org/2001/XMLSchema}appinfo',
'{http://www.w3.org/2001/XMLSchema}attribute',
'{http://www.w3.org/2001/XMLSchema}attributeGroup']
Schema objects include methods for finding XSD elements and attributes in the schema.
Those are methods ot the ElementTree's API, so you can use an XPath expression for

View File

@ -6,7 +6,7 @@ publiccodeYmlVersion: '0.2'
name: xmlschema
url: 'https://github.com/sissaschool/xmlschema'
landingURL: 'https://github.com/sissaschool/xmlschema'
releaseDate: '2019-xx-xx'
releaseDate: '2019-10-11'
softwareVersion: v1.0.15
developmentStatus: stable
platforms:

View File

@ -185,7 +185,6 @@ XSD_YEAR_MONTH_DURATION = XSD_TEMPLATE % 'yearMonthDuration'
XSD_ERROR = XSD_TEMPLATE % 'error'
def get_qname(uri, name):
"""
Returns an expanded QName from URI and local part. If any argument has boolean value

View File

@ -276,7 +276,7 @@ class TestXsdComplexType(XsdValidatorTestCase):
def test_upa_violation_with_wildcard(self):
self.check_schema("""
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="tns" xmlns:ns="tns" elementFormDefault="unqualified">
targetNamespace="tns" xmlns:ns="tns" elementFormDefault="unqualified">
<xs:complexType name="baseType">
<xs:sequence>
@ -295,7 +295,7 @@ class TestXsdComplexType(XsdValidatorTestCase):
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
""", XMLSchemaModelError if self.schema_class.XSD_VERSION == '1.0' else None)

View File

@ -247,7 +247,7 @@ class TestXsd11Wildcards(TestXsdWildcards):
<xs:any notNamespace="tns1"/> <xs:any namespace="##other"/>
<xs:any namespace="##other"/> <xs:any notNamespace="##local tns1"/>
<xs:any namespace="##other"/> <xs:any notNamespace="tns2"/>
<xs:any namespace="##any" notQName="##defined qn1"/>
<xs:any namespace="##any" notQName="##defined qn1"/>
<xs:any namespace="##local" notQName="##defined"/>
</xs:sequence>
</xs:group>

View File

@ -202,7 +202,7 @@ class XMLSchemaValidationError(XMLSchemaValidatorError, ValueError):
if not isinstance(obj, string_base_type):
_obj = obj
else:
_obj = obj.encode('ascii', 'xmlcharrefreplace').decode('utf-8')
_obj = obj.encode('ascii', 'xmlcharrefreplace').decode('utf-8')
super(XMLSchemaValidationError, self).__init__(
validator=validator,

View File

@ -250,8 +250,10 @@ class XsdWildcard(XsdComponent, ValidationMixin):
if not self.not_qname:
self.not_qname = other.not_qname[:]
else:
self.not_qname = [x for x in self.not_qname if x in other.not_qname or
not other.is_namespace_allowed(get_namespace(x))]
self.not_qname = [
x for x in self.not_qname
if x in other.not_qname or not other.is_namespace_allowed(get_namespace(x))
]
if self.not_namespace:
if other.not_namespace: