Page MenuHomeSoftware Heritage
Paste P1302

xmlschema uri
ActivePublic

Authored by vlorentz on Feb 24 2022, 6:35 PM.
✘ dev@desktop5  ~/swh-environment/swh-deposit   validate-metadata ●  pip3 show xmlschema
Name: xmlschema
Version: 1.9.2
Summary: An XML Schema validator and decoder
Home-page: https://github.com/sissaschool/xmlschema
Author: Davide Brunato
Author-email: brunato@sissa.it
License: MIT
Location: /home/dev/.local/lib/python3.9/site-packages
Requires: elementpath
Required-by:
dev@desktop5  ~/swh-environment/swh-deposit   validate-metadata ●  python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlschema
>>> schema = xmlschema.XMLSchema11('''<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element name="testurl" type="xsd:anyURI" /></xsd:schema>''')
>>> schema.validate('''<testurl>123 foo bar</testurl>''')
>>> schema.to_dict('''<testurl>123 foo bar</testurl>''')
'123 foo bar'

Event Timeline

vlorentz edited the content of this paste. (Show Details)