From 99fc56d3dbf56272cbf0e7caf0168da40b7ce75b Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 15 May 2020 01:08:56 +0300 Subject: [PATCH] Releasing v20.5.1 --- .pre-commit-config.yaml | 4 + CHANGES.rst | 12 +- README.rst | 61 ++-- docs/_static/demo.svg | 233 +++++++------ docs/about.rst | 10 +- docs/architecture.rst | 21 +- docs/codegen.rst | 6 +- docs/dataclasses.rst | 45 +-- docs/demo/demo.sh | 4 +- docs/demos.rst | 21 +- setup.cfg | 5 +- xsdata/models/elements.py | 711 +++++++++++++++++--------------------- 12 files changed, 540 insertions(+), 593 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c670b214..de776b354 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,3 +41,7 @@ repos: rev: v1.9.0 hooks: - id: setup-cfg-fmt + - repo: https://github.com/PyCQA/doc8 + rev: 0.8.1rc3 + hooks: + - id: doc8 diff --git a/CHANGES.rst b/CHANGES.rst index d00043629..325db1134 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,15 @@ -20.5 (2020-05-02) +20.5.1 (2020-05-14) ------------------- +- Added support to fetch remote schemas. +- Updated duplicate attribute names handling. +- Updated code generation for enum type fields and default values. +- Fixed issue not generating classes derived from simple types. +- Fixed analyzer reaching the maximum recursion depth. +- Fixed analyzer to flatten properly inner self referencing classes. +- Moved dataclasses python conventions to jinja filters. + +20.5 (2020-05-02) +----------------- - Updated codegen cli to accept multiple definitions or directories as argument. - Update ClassBuilder to recursively search for anonymous types. - Updated XmlParser to be thread-safe. diff --git a/README.rst b/README.rst index 2bc858cc4..b5c698762 100644 --- a/README.rst +++ b/README.rst @@ -27,38 +27,49 @@ Naive XML Bindings for python -------- +xsData is a complete XML data binding library for python allowing developers to access +and use XML documents as simple objects rather than using DOM. + +xsData comes with a code generator that can convert XML Schema 1.0 and 1.1 definitions +to simple dataclasses with type hints and as minimum footprint as possible. The +generated packages have no dependency on the library itself. So simple that you can +write the models on your own if you happen to use an XML document with no schema +available. + +The XML Parser is highly optimized and uses lxml iterparse to bind the document data to +the target models. The parser accepts a configuration instance with various options +like `fail on unknown properties` and is also thread safe which means you can take +advantage of the internal model inspection caching context for even faster parsing. + +The parser and serializer are constantly tested against the +`W3C XML Schema 1.1 test suite `_ and +passes more than 99% of the valid instance cases. + +.. image:: https://github.com/tefra/xsdata/raw/master/docs/_static/demo.svg + +Check the documentation `demos `_ or +our `W3C XML Schema 1.1 `_ test runner and +the `samples repo `_ for more ✨✨✨ + + Features -------- - Generate data models from XML Schema 1.0 and 1.1 definitions. -- Supports qualified/unqualified elements and attributes -- Supports enumerations and inner classes +- Supports qualified elements/attributes. +- Supports enumerations and inner classes. - Flattening strategies to keep the code as simple as possible. - Preserve embedded documentation and references - Pluggable code writer that supports different formats - Output: Python Data Classes - - - PEP8 naming conventions and code output - - Full support for type hints even with forward references - - XML Parser & Serializer based on lxml - - JSON Parser & Serializer - - Output: PlantUML class diagram -------- - -.. image:: https://github.com/tefra/xsdata/raw/master/docs/_static/demo.svg - -Check the documentation `test suites `_ or our `W3C XML Schema 1.1 `_ test runner and the `samples repo `_ for more ✨✨✨ - - -Changelog: 20.5 (2020-05-02) ----------------------------- -- Updated codegen cli to accept multiple definitions or directories as argument. -- Update ClassBuilder to recursively search for anonymous types. -- Updated XmlParser to be thread-safe. -- Added performance tweaks on XmlParser. -- Added parser config to fail or not on unknown properties. -- Fixed primitive types being marked as forward references. -- Fixed nested restrictions on xs:simpleType. -- Fixed ClassAnalyzer to recover/ignore missing types. +Changelog: 20.5.1 (2020-05-14) +------------------------------ +- Added support to fetch remote schemas. +- Updated duplicate attribute names handling. +- Updated code generation for enum type fields and default values. +- Fixed issue not generating classes derived from simple types. +- Fixed analyzer reaching the maximum recursion depth. +- Fixed analyzer to flatten properly inner self referencing classes. +- Moved dataclasses python conventions to jinja filters. diff --git a/docs/_static/demo.svg b/docs/_static/demo.svg index fbc5203b0..94a6c59a2 100644 --- a/docs/_static/demo.svg +++ b/docs/_static/demo.svg @@ -16,129 +16,128 @@ } :root { - --animation-duration: 23994ms; + --animation-duration: 23332ms; } @keyframes roll { 0.000%{transform:translateY(0px)} -3.159%{transform:translateY(-272px)} -3.918%{transform:translateY(-544px)} -4.297%{transform:translateY(-816px)} -4.676%{transform:translateY(-1088px)} -5.055%{transform:translateY(-1360px)} -5.431%{transform:translateY(-1632px)} -7.589%{transform:translateY(-1904px)} -8.573%{transform:translateY(-2176px)} -11.995%{transform:translateY(-2448px)} -12.753%{transform:translateY(-2720px)} -13.137%{transform:translateY(-2992px)} -15.691%{transform:translateY(-3264px)} -15.708%{transform:translateY(-3536px)} -20.964%{transform:translateY(-3808px)} -21.722%{transform:translateY(-4080px)} -22.097%{transform:translateY(-4352px)} -22.472%{transform:translateY(-4624px)} -22.852%{transform:translateY(-4896px)} -23.231%{transform:translateY(-5168px)} -23.610%{transform:translateY(-5440px)} -23.989%{transform:translateY(-5712px)} -24.369%{transform:translateY(-5984px)} -24.748%{transform:translateY(-6256px)} -25.506%{transform:translateY(-6528px)} -25.881%{transform:translateY(-6800px)} -26.261%{transform:translateY(-7072px)} -26.636%{transform:translateY(-7344px)} -27.015%{transform:translateY(-7616px)} -27.390%{transform:translateY(-7888px)} -27.765%{transform:translateY(-8160px)} -29.662%{transform:translateY(-8432px)} -30.616%{transform:translateY(-8704px)} -31.416%{transform:translateY(-8976px)} -31.429%{transform:translateY(-9248px)} -31.633%{transform:translateY(-9520px)} -31.729%{transform:translateY(-9792px)} -31.741%{transform:translateY(-10064px)} -32.283%{transform:translateY(-10336px)} -32.300%{transform:translateY(-10608px)} -32.804%{transform:translateY(-10880px)} -33.133%{transform:translateY(-11152px)} -33.863%{transform:translateY(-11424px)} -33.888%{transform:translateY(-11696px)} -34.054%{transform:translateY(-11968px)} -34.755%{transform:translateY(-12240px)} -35.188%{transform:translateY(-12512px)} -37.568%{transform:translateY(-12784px)} -38.322%{transform:translateY(-13056px)} -38.706%{transform:translateY(-13328px)} -39.081%{transform:translateY(-13600px)} -39.464%{transform:translateY(-13872px)} -39.839%{transform:translateY(-14144px)} -40.218%{transform:translateY(-14416px)} -40.593%{transform:translateY(-14688px)} -43.165%{transform:translateY(-14960px)} -43.182%{transform:translateY(-15232px)} -46.474%{transform:translateY(-15504px)} -47.233%{transform:translateY(-15776px)} -47.608%{transform:translateY(-16048px)} -47.987%{transform:translateY(-16320px)} -48.366%{transform:translateY(-16592px)} -48.741%{transform:translateY(-16864px)} -49.125%{transform:translateY(-17136px)} -49.500%{transform:translateY(-17408px)} -49.879%{transform:translateY(-17680px)} -50.258%{transform:translateY(-17952px)} -51.013%{transform:translateY(-18224px)} -51.396%{transform:translateY(-18496px)} -51.775%{transform:translateY(-18768px)} -52.151%{transform:translateY(-19040px)} -52.530%{transform:translateY(-19312px)} -52.905%{transform:translateY(-19584px)} -53.284%{transform:translateY(-19856px)} -53.663%{transform:translateY(-20128px)} -54.043%{transform:translateY(-20400px)} -54.418%{transform:translateY(-20672px)} -55.176%{transform:translateY(-20944px)} -55.556%{transform:translateY(-21216px)} -58.269%{transform:translateY(-21488px)} -58.481%{transform:translateY(-21760px)} -58.498%{transform:translateY(-22032px)} -58.531%{transform:translateY(-22304px)} -61.782%{transform:translateY(-22576px)} -61.836%{transform:translateY(-22848px)} -61.865%{transform:translateY(-23120px)} -64.975%{transform:translateY(-23392px)} -65.054%{transform:translateY(-23664px)} -65.100%{transform:translateY(-23936px)} -65.154%{transform:translateY(-24208px)} -67.909%{transform:translateY(-24480px)} -67.950%{transform:translateY(-24752px)} -68.000%{transform:translateY(-25024px)} -68.034%{transform:translateY(-25296px)} -71.989%{transform:translateY(-25568px)} -72.122%{transform:translateY(-25840px)} -72.160%{transform:translateY(-26112px)} -72.210%{transform:translateY(-26384px)} -76.311%{transform:translateY(-26656px)} -76.361%{transform:translateY(-26928px)} -76.386%{transform:translateY(-27200px)} -76.411%{transform:translateY(-27472px)} -80.212%{transform:translateY(-27744px)} -80.233%{transform:translateY(-28016px)} -80.249%{transform:translateY(-28288px)} -84.379%{transform:translateY(-28560px)} -84.409%{transform:translateY(-28832px)} -84.429%{transform:translateY(-29104px)} -84.454%{transform:translateY(-29376px)} -88.422%{transform:translateY(-29648px)} -88.489%{transform:translateY(-29920px)} -88.518%{transform:translateY(-30192px)} -95.711%{transform:translateY(-30464px)} -95.832%{transform:translateY(-30736px)} -100.000%{transform:translateY(-30736px)} +2.529%{transform:translateY(-272px)} +3.304%{transform:translateY(-544px)} +3.694%{transform:translateY(-816px)} +4.085%{transform:translateY(-1088px)} +4.475%{transform:translateY(-1360px)} +4.865%{transform:translateY(-1632px)} +7.149%{transform:translateY(-1904px)} +8.139%{transform:translateY(-2176px)} +12.549%{transform:translateY(-2448px)} +13.021%{transform:translateY(-2720px)} +13.797%{transform:translateY(-2992px)} +14.187%{transform:translateY(-3264px)} +14.577%{transform:translateY(-3536px)} +14.967%{transform:translateY(-3808px)} +15.357%{transform:translateY(-4080px)} +15.747%{transform:translateY(-4352px)} +16.137%{transform:translateY(-4624px)} +16.527%{transform:translateY(-4896px)} +16.917%{transform:translateY(-5168px)} +17.311%{transform:translateY(-5440px)} +18.087%{transform:translateY(-5712px)} +18.477%{transform:translateY(-5984px)} +18.867%{transform:translateY(-6256px)} +19.257%{transform:translateY(-6528px)} +22.750%{transform:translateY(-6800px)} +23.757%{transform:translateY(-7072px)} +24.391%{transform:translateY(-7344px)} +24.404%{transform:translateY(-7616px)} +24.559%{transform:translateY(-7888px)} +24.657%{transform:translateY(-8160px)} +24.683%{transform:translateY(-8432px)} +25.253%{transform:translateY(-8704px)} +25.270%{transform:translateY(-8976px)} +25.647%{transform:translateY(-9248px)} +25.994%{transform:translateY(-9520px)} +26.007%{transform:translateY(-9792px)} +26.646%{transform:translateY(-10064px)} +26.672%{transform:translateY(-10336px)} +26.830%{transform:translateY(-10608px)} +27.439%{transform:translateY(-10880px)} +27.807%{transform:translateY(-11152px)} +30.915%{transform:translateY(-11424px)} +31.695%{transform:translateY(-11696px)} +32.085%{transform:translateY(-11968px)} +32.475%{transform:translateY(-12240px)} +32.865%{transform:translateY(-12512px)} +33.255%{transform:translateY(-12784px)} +33.645%{transform:translateY(-13056px)} +34.035%{transform:translateY(-13328px)} +37.082%{transform:translateY(-13600px)} +37.104%{transform:translateY(-13872px)} +40.588%{transform:translateY(-14144px)} +41.364%{transform:translateY(-14416px)} +41.754%{transform:translateY(-14688px)} +42.144%{transform:translateY(-14960px)} +42.534%{transform:translateY(-15232px)} +42.924%{transform:translateY(-15504px)} +43.314%{transform:translateY(-15776px)} +43.704%{transform:translateY(-16048px)} +44.094%{transform:translateY(-16320px)} +44.484%{transform:translateY(-16592px)} +44.874%{transform:translateY(-16864px)} +45.654%{transform:translateY(-17136px)} +46.044%{transform:translateY(-17408px)} +46.434%{transform:translateY(-17680px)} +46.824%{transform:translateY(-17952px)} +47.218%{transform:translateY(-18224px)} +47.608%{transform:translateY(-18496px)} +47.994%{transform:translateY(-18768px)} +48.388%{transform:translateY(-19040px)} +48.779%{transform:translateY(-19312px)} +49.169%{transform:translateY(-19584px)} +49.944%{transform:translateY(-19856px)} +53.026%{transform:translateY(-20128px)} +53.244%{transform:translateY(-20400px)} +53.262%{transform:translateY(-20672px)} +53.292%{transform:translateY(-20944px)} +56.690%{transform:translateY(-21216px)} +56.828%{transform:translateY(-21488px)} +56.888%{transform:translateY(-21760px)} +60.483%{transform:translateY(-22032px)} +60.561%{transform:translateY(-22304px)} +60.621%{transform:translateY(-22576px)} +60.723%{transform:translateY(-22848px)} +63.844%{transform:translateY(-23120px)} +63.925%{transform:translateY(-23392px)} +64.002%{transform:translateY(-23664px)} +64.049%{transform:translateY(-23936px)} +68.404%{transform:translateY(-24208px)} +68.507%{transform:translateY(-24480px)} +68.575%{transform:translateY(-24752px)} +68.644%{transform:translateY(-25024px)} +71.618%{transform:translateY(-25296px)} +71.670%{transform:translateY(-25568px)} +71.713%{transform:translateY(-25840px)} +71.743%{transform:translateY(-26112px)} +75.377%{transform:translateY(-26384px)} +75.480%{transform:translateY(-26656px)} +75.570%{transform:translateY(-26928px)} +79.492%{transform:translateY(-27200px)} +79.642%{transform:translateY(-27472px)} +79.706%{transform:translateY(-27744px)} +79.757%{transform:translateY(-28016px)} +83.070%{transform:translateY(-28288px)} +83.143%{transform:translateY(-28560px)} +83.203%{transform:translateY(-28832px)} +86.203%{transform:translateY(-29104px)} +86.289%{transform:translateY(-29376px)} +86.358%{transform:translateY(-29648px)} +90.271%{transform:translateY(-29920px)} +90.331%{transform:translateY(-30192px)} +95.714%{transform:translateY(-30464px)} +100.000%{transform:translateY(-30464px)} } #screen_view { - animation-duration: 23994ms; + animation-duration: 23332ms; animation-iteration-count:infinite; animation-name:roll; animation-timing-function: steps(1,end); @@ -173,5 +172,5 @@ - # Hi, welcome to xsdata demo! xs xsdat xsdata - xsdata --he xsdata --help xsdata --helpUsage: xsdata [OPTIONS] SOURCES... Convert schema definitions to code. SOURCES can be one or more files or directories.Options: --package TEXT Target Package [required] --output [pydata|plantuml] Output Format --print Preview the resulting classes. -v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG --help Show this message and exit.cl clear clear x xsda xsdata xsdata sab xsdata sabre/ xsdata sabre/sch xsdata sabre/schema xsdata sabre/schemas - xsdata sabre/schemas --pa xsdata sabre/schemas --pack xsdata sabre/schemas --package xsdata sabre/schemas --package sa xsdata sabre/schemas --package sabre xsdata sabre/schemas --package sabre.mo xsdata sabre/schemas --package sabre.model xsdata sabre/schemas --package sabre.models xsdata sabre/schemas --package sabre.models Parsing schema... Parsing schema... Compiling schema... Builder: 4 main and 0 inner classesParsing schema... Compiling schema... Builder: 67 main and 18 inner classes Compiling schema... Builder: 159 main and 224 inner classes Parsing schema... Compiling schema... Builder: 70 main and 146 inner classes Analyzer: 162 main and 418 inner classesGenerating package: initGenerating package: sabre.models.bargain_finder_max_common_types_v1_9_7Generating package: sabre.models.bargain_finder_max_rq_v1_9_7Generating package: sabre.models.bargain_finder_max_rs_v1_9_7ls ls -l ls -la s ls -la sabre ls -la sabre/mo ls -la sabre/model ls -la sabre/models ls -la sabre/modelstotal 616drwxrwxr-x 3 chris chris 4096 Apr 27 14:41 .drwxrwxr-x 5 chris chris 4096 Apr 30 20:39 ..-rw-rw-r-- 1 chris chris 25459 May 2 20:16 bargain_finder_max_common_types_v1_9_7.py-rw-rw-r-- 1 chris chris 350902 May 2 20:16 bargain_finder_max_rq_v1_9_7.py-rw-rw-r-- 1 chris chris 222093 May 2 20:16 bargain_finder_max_rs_v1_9_7.py-rw-rw-r-- 1 chris chris 11993 May 2 20:16 __init__.pydrwxrwxr-x 2 chris chris 4096 Apr 30 20:51 __pycache__b bat bat sab bat sabre/ bat sabre/mod bat sabre/models bat sabre/models/ba bat sabre/models/barga bat sabre/models/bargain_ bat sabre/models/bargain_fi bat sabre/models/bargain_finde bat sabre/models/bargain_finder_m bat sabre/models/bargain_finder_max_ bat sabre/models/bargain_finder_max_com bat sabre/models/bargain_finder_max_common bat sabre/models/bargain_finder_max_common_ty bat sabre/models/bargain_finder_max_common_types bat sabre/models/bargain_finder_max_common_types_v1 bat sabre/models/bargain_finder_max_common_types_v1_9_ bat sabre/models/bargain_finder_max_common_types_v1_9_7. bat sabre/models/bargain_finder_max_common_types_v1_9_7.py bat sabre/models/bargain_finder_max_common_types_v1_9_7.py───────┬─────────────────────────────────────────────────────────────────────────────────────── File: sabre/models/bargain_finder_max_common_types_v1_9_7.py───────┼─────────────────────────────────────────────────────────────────────────────────────── 1 from decimal import Decimal 2 2 from enum import Enum 3 from dataclasses import dataclass, field 4 from typing import List, Optional 5 6 __NAMESPACE__ = " 6 __NAMESPACE__ = "http://www.opentravel.org/OTA/2003/05" 7 8 9 class AirTripType(Enum): 10 """ 11 Identifies the trip type - one way, return, circle trip, open jaw.: 12 :cvar CIRCLE: 13 :cvar ONE_WAY: 14 :cvar OPEN_JAW: 15 :cvar OTHER: 16 :cvar RETURN_VALUE: 17 """ 18 CIRCLE = "Circle" 19 ONE_WAY = "OneWay" 20 OPEN_JAW = 20 OPEN_JAW = "OpenJaw" 21 OTHER = "Other" 22 RETURN_VALUE = "Return" 23 24 25 @dataclass 26 class CompanyNameType: 27 """Identifies a company by name. 28 29 :ivar value: 30 :ivar company_short_name: 31 :ivar travel_sector: Refer to OTA Code List Travel Sector (TVS). 32 :ivar code: Identifies a company by the company code. 33 :ivar code_context: Identifies the context of the identifying code, such as DUNS, IATA or inter IATA or internal code, etc. 34 """ 35 value: Optional[str] = field( 36 default=None, 37 ) 38 company_short_name: Optional[str 38 company_short_name: Optional[str] = field( 39 default=None, 40 metadata=dict( 41 name="CompanyShortName", 42 type="Attribute", 43 min_length=1. 43 min_length=1.0, 44 max_length=64.0 45 ) 46 ) 47 travel_sector: Optional[str] = field( 48 default=None, 49 metadata=dict( 50 name="TravelSector", 51 type="Attribute" 52 ) 53 ) 54 code: Optional[str] = field( 55 default=None, 56 metadata=dict( 57 name="Code 57 name="Code", 58 type="Attribute", 59 min_length=1.0, 60 max_length=8.0 61 ) 62 ) 63 code_context 63 code_context: Optional[str] = field( 64 default=None, 65 metadata=dict( 66 name="CodeContext", 67 type="Attribute", 68 min_length=1.0, 69 max_length=32.0 70 ) 71 ) 72 73 74 74 class DepartureOrArrival(Enum): 75 """ 76 :cvar ARRIVAL: 77 :cvar DEPARTURE: 78 """ 79 ARRIVAL = "Arrival" 80 DEPARTURE = "Departur 80 DEPARTURE = "Departure" 81 82 83 @dataclass 84 class EquipmentType: 85 """Specifies the aircraft equipment type. 86 87 :ivar value: 88 :ivar air_equip_type: This is the 3 character IATA code. 89 :ivar changeof_gauge: Indicates there is an equipment change. 90 """ 91 91 value: Optional[str] = field( 92 default=None, 93 ) 94 air_equip_type: Optional[str] = field( 95 default=None, 96 metadata=dict( 97 name="AirEquipType", 98 type="Attribute", 99 required=True, 100 min_length=3.0, 101 max_length=3.0 102 ) 103 ) 104 changeof_gauge: bool = field( 105 105 default=False, 106 metadata=dict( 107 name="ChangeofGauge", 108 type="Attribute" 109 ) 110 ) 111 112 113 class FareDirectionality(Enum): 114 """ 115 :cvar FROM_VALUE: 116 :cvar TO: 117 """ 118 FROM_VALUE 118 FROM_VALUE = "FROM" 119 TO = "TO" 120 121 122 class OutboundOrInbound(Enum):# See help for more, bye bye :) + # Hi, welcome to xsdata demo! xs xsdat xsdata - xsdata --hel xsdata --help xsdata --helpUsage: xsdata [OPTIONS] SOURCES... Convert schema definitions to code. SOURCES can be one or more files or directories or urls.Options: --package TEXT Target Package [required] --output [pydata|plantuml] Output Format --print Preview the resulting classes. -v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG --help Show this message and exit. xs xsdat xsdata s xsdata sabre xsdata sabre/sc xsdata sabre/schem xsdata sabre/schemas xsdata sabre/schemas --p xsdata sabre/schemas --packa xsdata sabre/schemas --package xsdata sabre/schemas --package sab xsdata sabre/schemas --package sabre. xsdata sabre/schemas --package sabre.mod xsdata sabre/schemas --package sabre.models xsdata sabre/schemas --package sabre.models Parsing schema... Parsing schema... Compiling schema...Builder: 4 main and 0 inner classes Compiling schema... Builder: 67 main and 18 inner classes Builder: 159 main and 224 inner classes Parsing schema... Compiling schema... Builder: 70 main and 146 inner classes Analyzer input: 300 main and 388 inner classes Analyzer output: 162 main and 418 inner classesGenerating package: initGenerating package: sabre.models.bargain_finder_max_common_types_v1_9_7Generating package: sabre.models.bargain_finder_max_rq_v1_9_7Generating package: sabre.models.bargain_finder_max_rs_v1_9_7ls ls -l ls -la s ls -la sabr ls -la sabre/m ls -la sabre/mode ls -la sabre/models ls -la sabre/modelstotal 616drwxrwxr-x 3 chris chris 4096 May 14 23:26 .drwxrwxr-x 6 chris chris 4096 May 14 23:29 ..-rw-rw-r-- 1 chris chris 25459 May 14 23:33 bargain_finder_max_common_types_v1_9_7.py-rw-rw-r-- 1 chris chris 351092 May 14 23:33 bargain_finder_max_rq_v1_9_7.py-rw-rw-r-- 1 chris chris 222112 May 14 23:33 bargain_finder_max_rs_v1_9_7.py-rw-rw-r-- 1 chris chris 11993 May 14 23:33 __init__.pydrwxrwxr-x 2 chris chris 4096 May 14 23:26 __pycache__b bat bat sab bat sabre/ bat sabre/mod bat sabre/models bat sabre/models/ba bat sabre/models/barga bat sabre/models/bargain_ bat sabre/models/bargain_fi bat sabre/models/bargain_finde bat sabre/models/bargain_finder_m bat sabre/models/bargain_finder_max_ bat sabre/models/bargain_finder_max_com bat sabre/models/bargain_finder_max_common bat sabre/models/bargain_finder_max_common_ty bat sabre/models/bargain_finder_max_common_types bat sabre/models/bargain_finder_max_common_types_v1 bat sabre/models/bargain_finder_max_common_types_v1_9_ bat sabre/models/bargain_finder_max_common_types_v1_9_7. bat sabre/models/bargain_finder_max_common_types_v1_9_7.py bat sabre/models/bargain_finder_max_common_types_v1_9_7.py───────┬─────────────────────────────────────────────────────────────────────────────────────── File: sabre/models/bargain_finder_max_common_types_v1_9_7.py───────┼─────────────────────────────────────────────────────────────────────────────────────── 1 from decimal import Decimal 2 2 from enum import Enum 3 from dataclasses import dataclass, field 4 from typing import List, Optional 5 6 __NAMESPACE__ = " 6 __NAMESPACE__ = "http://www.opentravel.org/OTA/2003/05" 7 8 9 class AirTripType(Enum): 10 """ 11 Identifies the trip type - one way, return, circle trip, open jaw.: 12 :cvar ONE_WAY: 13 :cvar RETURN_VALUE: 14 :cvar CIRCLE: 15 :cvar OPEN_JAW: 16 :cvar OTHER: 17 """ 18 ONE_WAY = "OneWay" 19 RETURN_VALUE = "Return" 20 CIRCLE = "Circle" 20 CIRCLE = "Circle" 21 OPEN_JAW = "OpenJaw" 22 OTHER = "Other" 23 24 25 @dataclass 26 class CompanyNameType: 27 """Identifies a company by name. 28 29 :ivar value: 30 :ivar company_short_name: 31 :ivar travel_sector: Refer to OTA Code List Travel Sector (TVS). 32 :ivar code: Identifies a company by the company code. 33 :ivar code_context: Identifies the context of the identifying code, such as DUNS, IATA or inter IATA or internal code, etc. 34 """ 35 value: Optional[str] = field( 36 default=None, 37 ) 38 company_short_name: Optional[str 38 company_short_name: Optional[str] = field( 39 default=None, 40 metadata=dict( 41 name="CompanyShortName", 42 type="Attribute", 43 min_length=1. 43 min_length=1.0, 44 max_length=64.0 45 ) 46 ) 47 travel_sector: Optional[str] = field( 48 default=None, 49 metadata=dict( 50 name="TravelSector", 51 type="Attribute" 52 ) 53 ) 54 code: Optional[str] = field( 55 default=None, 56 metadata=dict( 57 name="Code 57 name="Code", 58 type="Attribute", 59 min_length=1.0, 60 max_length=8.0 61 ) 62 ) 63 code_context 63 code_context: Optional[str] = field( 64 default=None, 65 metadata=dict( 66 name="CodeContext", 67 type="Attribute", 68 min_length=1.0, 69 max_length=32.0 70 ) 71 ) 72 73 74 74 class DepartureOrArrival(Enum): 75 """ 76 :cvar DEPARTURE: 77 :cvar ARRIVAL: 78 """ 79 DEPARTURE = "Departure" 80 ARRIVAL = "Arriva 80 ARRIVAL = "Arrival" 81 82 83 @dataclass 84 class EquipmentType: 85 """Specifies the aircraft equipment type. 86 87 :ivar value: 88 :ivar air_equip_type: This is the 3 character IATA code. 89 :ivar changeof_gauge: Indicates there is an equipment change. 90 """ 91 91 value: Optional[str] = field( 92 default=None, 93 ) 94 air_equip_type: Optional[str] = field( 95 default=None, 96 metadata=dict( 97 name="AirEquipType", 98 type="Attribute", 99 required=True, 100 min_length=3.0, 101 max_length=3.0 102 ) 103 ) 104 changeof_gauge: bool = field( 105 105 default=False, 106 metadata=dict( 107 name="ChangeofGauge", 108 type="Attribute" 109 ) 110 ) 111 112 113 class FareDirectionality(Enum): 114 """ 115 :cvar TO: 116 :cvar FROM_VALUE: 117 """ 118 TO 118 TO = "TO" 119 FROM_VALUE = "FROM" 120 121 122 class OutboundOrInbound(Enum): 123 """ 124 :cvar OUTBOUND: 125 :cvar INBOUND: 126 """ 127 OUTBOUND = "Outbound" 128 INBOUND = "Inbound" 129 130 131 131 class StayUnitType(Enum): 132 """Defines the 'Units' that can be applied to Stay restrictions. 133 134 :cvar MINUTES: 135 :cvar HOURS: 136 :cvar DAYS:# See help for more, bye bye :) diff --git a/docs/about.rst b/docs/about.rst index 1e77fa246..308da8627 100644 --- a/docs/about.rst +++ b/docs/about.rst @@ -4,11 +4,15 @@ About Why --- -Python soap clients are either dead or all of them follow the all-in-one pattern that hides all the complexity of the api from the end-user. +Python soap clients are either dead or all of them follow the all-in-one pattern that +hides all the complexity of the api from the end-user. -Python XML Binding libraries exist but either they never worked for the schemas I was working with or generated code that was very hard to read and understand. +Python XML Binding libraries exist but either they never worked for the schemas I was +working with or generated code that was very hard to read and understand. -xsData is inspired by the Java XML Binding JaxB and with the rise of python model classes like attrs, dataclasses or pydantic and the native python type hints, I felt it was time to create something similar for python. +xsData is inspired by the Java XML Binding JaxB and with the rise of python model +classes like attrs, dataclasses or pydantic and the native python type hints, I felt it +was time to create something similar for python. Compare diff --git a/docs/architecture.rst b/docs/architecture.rst index ecc3970ff..5c17c3e64 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -19,7 +19,8 @@ Schema Parser :class:`xsdata.parser.SchemaParser` -The schema parser objectifies the xml data to simple python dataclass instances that are easy to work and extract all the relevant information. +The schema parser objectifies the xml data to simple python dataclass instances that +are easy to work and extract all the relevant information. @@ -28,7 +29,8 @@ Class Builder :class:`xsdata.builder.ClassBuilder` -The builder goes through all the root elements of a schema to create a list of class candidates. +The builder goes through all the root elements of a schema to create a list of class +candidates. * All root elements are considered class candidates * Traverse the root elements object tree @@ -36,11 +38,13 @@ The builder goes through all the root elements of a schema to create a list of c * Detect inner classes * Assign namespaces and default ``value`` fields -**Root elements**: ``simpleType``, ``attributeGroup``, ``group``, ``attribute``, ``complexType``, ``element`` +**Root elements**: ``simpleType``, ``attributeGroup``, ``group``, ``attribute``, +``complexType``, ``element`` **Field elements**: ``attribute``, ``enumeration``, ``restiction``, ``element`` -**Extension elements**: ``union``, ``attributeGroup``, ``group``, ``extension``, ``restriction`` +**Extension elements**: ``union``, ``attributeGroup``, ``group``, ``extension``, +``restriction`` Class Analyzer @@ -48,7 +52,8 @@ Class Analyzer :class:`xsdata.analyzer.ClassAnalyzer` -The analyzer goes through all class candidates and flattens attributes and extensions based on certain criteria. +The analyzer goes through all class candidates and flattens attributes and extensions +based on certain criteria. Promote for generation: @@ -56,11 +61,13 @@ Promote for generation: * Classes derived from xsd ``complexType`` with ``abstract`` flag set to ``False`` * Classes derived from xsd ``restiction`` with ``enumeration`` fields -The rest of the classes are marked as common and are used to flatten attributes and extensions of the promoted classes in the current schema and any upcoming sub-schemas. +The rest of the classes are marked as common and are used to flatten attributes and +extensions of the promoted classes in the current schema and any upcoming sub-schemas. Code Writer ------------ :class:`xsdata.writer.CodeWriter` -Code writer is a factory that delegates the code generation with any language and library conventions to the given format. +Code writer is a factory that delegates the code generation with any language and +library conventions to the given format. diff --git a/docs/codegen.rst b/docs/codegen.rst index 3ab7e7cfe..5bc6adb68 100644 --- a/docs/codegen.rst +++ b/docs/codegen.rst @@ -26,7 +26,8 @@ want to process. Package ------- -The package option defines where the target module(s) will be created inside the current working directory. +The package option defines where the target module(s) will be created inside the +current working directory. If the main xsd has any parent include or import you should adjust the target package. @@ -55,7 +56,8 @@ Available options: ``CRITICAL``, ``ERROR``, ``WARNING``, ``INFO`` or ``DEBUG`` Print ----- -The print flag overwrites the verbosity level to `Error` and print to stdOut the output result without writing to the target file. +The print flag overwrites the verbosity level to `Error` and print to stdOut the output +result without writing to the target file. .. admonition:: Examples diff --git a/docs/dataclasses.rst b/docs/dataclasses.rst index 59912690d..7412cd6cd 100644 --- a/docs/dataclasses.rst +++ b/docs/dataclasses.rst @@ -72,7 +72,8 @@ Class Meta Field Typing ============ -Simply follow the Python lib `dataclasses `_ documentation. +Simply follow the Python lib +`dataclasses `_ documentation. .. admonition:: Notes :class: warning @@ -319,45 +320,3 @@ but it lacks maturity and test coverage. from xsdata.formats.dataclass.parsers import JsonParser obj = parser.from_path("/some.json, PurchaseOrder) - - - -Data Types -========== - -In table below you case find all the xml schema data types and their mapping to -primitive python types. - -+---------+------------------------------------------------------------------------------------+ -| Python | XML Schema Types | -+---------+----------------------+-----------------+----------------------+--------------------+ -| str | anyURI | anySimpleType | base | base64Binary | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | date | dateTime | derivationControl | duration | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | gDay | gMonth | gMonthDay | gYear | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | gYearMonth | ID | IDREF | hexBinary | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | IDREFS | lang | language | Name | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | NCName | NMTOKEN | NMTOKENS | normalizedString | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | NOTATION | QName | simpleDerivationSet | string | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | time | token | | | -+---------+----------------------+-----------------+----------------------+--------------------+ -| bool | boolean | | | | -+---------+----------------------+-----------------+----------------------+--------------------+ -| int | byte | ENTITIES | ENTITY | int | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | integer | long | negativeInteger | nonNegativeInteger | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | nonPositiveInteger | positiveInteger | short | unsignedByte | -+---------+----------------------+-----------------+----------------------+--------------------+ -| float | double | float | | | -+---------+----------------------+-----------------+----------------------+--------------------+ -| Decimal | decimal | | | | -+---------+----------------------+-----------------+----------------------+--------------------+ -| | | | | | -+---------+----------------------+-----------------+----------------------+--------------------+ diff --git a/docs/demo/demo.sh b/docs/demo/demo.sh index 5fc84da54..610271e79 100755 --- a/docs/demo/demo.sh +++ b/docs/demo/demo.sh @@ -4,7 +4,9 @@ echo -e "\e[35m# Hi, welcome to xsdata demo!" pe "xsdata --help" -pe "clear" + +sleep 1 +clear cd ../xsdata-samples diff --git a/docs/demos.rst b/docs/demos.rst index da6a05a82..d2533ec4a 100644 --- a/docs/demos.rst +++ b/docs/demos.rst @@ -21,7 +21,8 @@ then converting them back to JSON and XML documents. .. admonition:: Samples Source :class: hint - `Definitive XML Schema `_ by Priscilla Walmsley (c) 2012 Prentice Hall PTR + `Definitive XML Schema `_ by Priscilla + Walmsley (c) 2012 Prentice Hall PTR .. toctree:: :maxdepth: 1 @@ -34,21 +35,26 @@ then converting them back to JSON and XML documents. W3C XML Schema Suite ==================== -xsdata is constantly tested and measured against the `W3C XML Schema 1.1 test suite `_. +xsdata is constantly tested and measured against the +`W3C XML Schema 1.1 test suite `_. -The suite is quite extensible and consist of more than 26k tests cases for both XML Schema 1.0 and 1.1. +The suite is quite extensible and consist of more than 26k tests cases for both XML +Schema 1.0 and 1.1. .. hint:: - Because of the size and time it takes to run the test runner is on it's own `repo `_. + Because of the size and time it takes to run the test runner is on it's own + `repo `_. - At least until I can manage to reduce the total run time which is about 8 minutes without coverage. + At least until I can manage to reduce the total run time which is about 8 minutes + without coverage. Report ------ -**46** failed, **14520** passed, **110** skipped @ `travis-ci `_ +**45** failed, **14521** passed, **110** skipped @ +`travis-ci `_ ✨✨✨✨ @@ -65,7 +71,8 @@ Methodology - **Skip** if original instance or schema also fail validation. -For all XML Schema definitions we use the `xmlschema `_ to validate results. +For all XML Schema definitions we use the +`xmlschema `_ to validate results. .. hint:: diff --git a/setup.cfg b/setup.cfg index 93339d51a..69c37c7ad 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = xsdata -version = 20.5 +version = 20.5.1 description = Python XML Binding long_description = file: README.rst long_description_content_type = text/x-rst @@ -62,3 +62,6 @@ exclude = tests/* max-line-length = 88 ignore = W503,ANN101,ANN102 + +[doc8] +max-line-length = 88 diff --git a/xsdata/models/elements.py b/xsdata/models/elements.py index f4198bc01..e6a9f0a84 100644 --- a/xsdata/models/elements.py +++ b/xsdata/models/elements.py @@ -62,12 +62,12 @@ def render(self) -> str: @dataclass class Documentation(ElementBase): """ - - Content: ({any})* - + Schema Model. + + :param lang: language + :param source: anyURI + :param elements: ({any})* + :param attributes: any attributes with non-schema namespace """ class Meta: @@ -85,11 +85,11 @@ def tostring(self) -> Optional[str]: @dataclass class Appinfo(ElementBase): """ - - Content: ({any})* - + Schema Model. + + :param lang: language + :param source: anyURI + :param attributes: any attributes with non-schema namespace """ class Meta: @@ -103,11 +103,11 @@ class Meta: @dataclass class Annotation(ElementBase): """ - - Content: (appinfo | documentation)* - + Schema Model. + + :param appinfo: + :param documentations: + :param any_attribute: any attributes with non-schema namespace """ appinfo: Optional[Appinfo] = element() @@ -117,7 +117,13 @@ class Annotation(ElementBase): @dataclass class AnnotationBase(ElementBase): - """Base Class for elements that can contain annotations.""" + """ + Base Class for elements that can contain annotations. + + :param id: ID + :param annotation: + :param any_attribute: any attributes with non-schema namespace + """ id: Optional[str] = attribute() annotation: Optional[Annotation] = element() @@ -135,15 +141,10 @@ def display_help(self) -> Optional[str]: @dataclass class AnyAttribute(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param namespace: ##any | ##other) | List of anyURI | (##targetNamespace | ##local) + :param process_contents: (lax | skip | strict) : strict """ namespace: Optional[str] = attribute(default="##any") @@ -180,14 +181,9 @@ def real_type(self) -> Optional[str]: @dataclass class Assertion(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param test: an XPath expression """ test: Optional[str] = attribute() @@ -196,13 +192,12 @@ class Assertion(AnnotationBase): @dataclass class SimpleType(AnnotationBase): """ - - Content: (annotation?, (restriction | list | union)) - + Schema Model. + + :param name: NCName + :param restriction: + :param list: + :param union: """ name: Optional[str] = attribute() @@ -250,12 +245,10 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class List(AnnotationBase): """ - - Content: (annotation?, simpleType?) - + Schema Model. + + :param simple_type: + :param item_type: QName """ simple_type: Optional[SimpleType] = element(name="simpleType") @@ -280,12 +273,10 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class Union(AnnotationBase): """ - - Content: (annotation?, simpleType*) - + Schema Model. + + :param member_types: List of QName + :param simple_types: """ member_types: Optional[str] = attribute(name="memberTypes") @@ -331,20 +322,17 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class Attribute(AnnotationBase): """ - - Content: (annotation?, simpleType?) - + Schema Model. + + :param default: string + :param fixed: string + :param form: qualified | unqualified + :param name: NCName + :param ref: QName + :param type: QName + :param target_namespace: anyURI + :param simple_type: + :param use: (optional | prohibited | required) : optional """ default: Optional[str] = attribute() @@ -388,12 +376,12 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class AttributeGroup(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param name: NCName + :param ref: QName + :param attributes: any attributes with non-schema namespace + :param attribute_groups: """ name: Optional[str] = attribute() @@ -413,17 +401,12 @@ def real_type(self) -> Optional[str]: @dataclass class Any(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param min_occurs: nonNegativeInteger : 1 + :param max_occurs: (nonNegativeInteger | unbounded) : 1 + :param namespace: List of (anyURI | (##targetNamespace | ##local)) + :param process_contents: (lax | skip | strict) : strict """ min_occurs: int = attribute(default=1, name="minOccurs") @@ -465,13 +448,13 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class All(AnnotationBase): """ - - Content: (annotation?, (element | any | group)*) - + Schema Model. + + :param min_occurs: nonNegativeInteger : 1 + :param max_occurs: (nonNegativeInteger | unbounded) : 1 + :param any: + :param elements: + :param groups: """ min_occurs: int = attribute(default=1, name="minOccurs") @@ -487,13 +470,15 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class Sequence(AnnotationBase): """ - - Content: (annotation?, (element | group | choice | sequence | any)*) - + Schema Model. + + :param min_occurs: nonNegativeInteger : 1 + :param max_occurs: (nonNegativeInteger | unbounded) : 1 + :param elements: + :param groups: + :param choices: + :param sequences: + :param any: """ min_occurs: int = attribute(default=1, name="minOccurs") @@ -513,13 +498,15 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class Choice(AnnotationBase): """ - - Content: (annotation?, (element | group | choice | sequence | any)*) - + Schema Model. + + :param min_occurs: nonNegativeInteger : 1 + :param max_occurs: (nonNegativeInteger | unbounded) : 1 + :param elements: + :param groups: + :param choices: + :param sequences: + :param any: """ min_occurs: int = attribute(default=1, name="minOccurs") @@ -539,15 +526,15 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class Group(AnnotationBase): """ - - Content: (annotation?, (all | choice | sequence)?) - + Schema Model. + + :param name: NCName + :param ref: QName + :param min_occurs: nonNegativeInteger : 1 + :param max_occurs: (nonNegativeInteger | unbounded) : 1 + :param all: + :param choice: + :param sequence: """ name: Optional[str] = attribute() @@ -573,12 +560,11 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class OpenContent(AnnotationBase): """ - - Content: (annotation?, any?) - + Schema Model. + + :param applies_to_empty: default false + :param mode: (none | interleave | suffix) : interleave + :param any: """ applies_to_empty: bool = attribute(default=False, name="appliesToEmpty") @@ -588,26 +574,24 @@ class OpenContent(AnnotationBase): @dataclass class DefaultOpenContent(OpenContent): - """ - - Content: (annotation?, any) - - """ + """Schema Model.""" @dataclass class Extension(AnnotationBase): """ - - Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?), assert*) - + Schema Model. + + :param base: QName + :param group: + :param all: + :param choice: + :param sequence: + :param any_attribute: any attributes with non-schema namespace + :param open_content: + :param attributes: + :param attribute_groups: + :param assertions: """ base: Optional[str] = attribute() @@ -629,12 +613,9 @@ def extends(self) -> Optional[str]: @dataclass class Enumeration(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: anySimpleType """ value: str = attribute() @@ -659,13 +640,9 @@ def default(self) -> str: @dataclass class FractionDigits(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: nonNegativeInteger """ value: int = attribute() @@ -674,13 +651,9 @@ class FractionDigits(AnnotationBase): @dataclass class Length(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: nonNegativeInteger """ value: int = attribute() @@ -689,13 +662,9 @@ class Length(AnnotationBase): @dataclass class MaxExclusive(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: anySimpleType """ value: float = attribute() @@ -704,13 +673,9 @@ class MaxExclusive(AnnotationBase): @dataclass class MaxInclusive(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: anySimpleType """ value: float = attribute() @@ -719,13 +684,9 @@ class MaxInclusive(AnnotationBase): @dataclass class MaxLength(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: nonNegativeInteger """ value: float = attribute() @@ -734,13 +695,9 @@ class MaxLength(AnnotationBase): @dataclass class MinExclusive(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: anySimpleType """ value: float = attribute() @@ -749,13 +706,9 @@ class MinExclusive(AnnotationBase): @dataclass class MinInclusive(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: anySimpleType """ value: float = attribute() @@ -764,13 +717,9 @@ class MinInclusive(AnnotationBase): @dataclass class MinLength(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: nonNegativeInteger """ value: float = attribute() @@ -779,12 +728,9 @@ class MinLength(AnnotationBase): @dataclass class Pattern(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: string """ value: str = attribute() @@ -793,13 +739,9 @@ class Pattern(AnnotationBase): @dataclass class TotalDigits(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: positiveInteger """ value: int = attribute() @@ -808,28 +750,21 @@ class TotalDigits(AnnotationBase): @dataclass class WhiteSpace(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: (collapse | preserve | replace) """ - value: str = attribute() # preserve, collapse, replace + value: str = attribute() @dataclass class ExplicitTimezone(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param value: NCName + :param fixed: default false """ value: str = attribute() @@ -839,17 +774,33 @@ class ExplicitTimezone(AnnotationBase): @dataclass class Restriction(AnnotationBase): """ - - Content: (annotation?, (simpleType?, ( - minExclusive | minInclusive | maxExclusive | maxInclusive | - totalDigits | fractionDigits | length | minLength | maxLength | - enumeration | whiteSpace | pattern | assertion | explicitTimezone | - {any with namespace: ##other})*) - ) - + Schema Model. + + :param base: QName + :param group: + :param all: + :param choice: + :param sequence: + :param open_content: + :param attributes: + :param attribute_groups: + :param enumerations: + :param asserts: + :param assertions: + :param any_element: + :param min_exclusive: + :param min_inclusive: + :param min_length: + :param max_exclusive: + :param max_inclusive: + :param max_length: + :param total_digits: + :param fraction_digits: + :param length: + :param white_space: + :param patterns: + :param explicit_timezone: + :param simple_type: """ base: Optional[str] = attribute() @@ -931,11 +882,10 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class SimpleContent(AnnotationBase): """ - - Content: (annotation?, (restriction | extension)) - + Schema Model. + + :param restriction: + :param extension: """ restriction: Optional[Restriction] = element() @@ -945,12 +895,9 @@ class SimpleContent(AnnotationBase): @dataclass class ComplexContent(SimpleContent): """ - - Content: (annotation?, (restriction | extension)) - + Schema Model. + + :param fixed: """ mixed: bool = attribute(default=False) @@ -959,21 +906,25 @@ class ComplexContent(SimpleContent): @dataclass class ComplexType(AnnotationBase): """ - - Content: (annotation?, ( - simpleContent | complexContent | - (openContent?, (group | all | choice | sequence)?, - ((attribute | attributeGroup)*, anyAttribute?), assert*)) - ) - + Schema Model. + + :param name: NCName + :param block: (#all | List of (extension | restriction)) + :param final: (#all | List of (extension | restriction)) + :param simple_content: + :param complex_content: + :param group: + :param all: + :param choice: + :param sequence: + :param any_attribute: + :param open_content: + :param attributes: + :param attribute_groups: + :param assertion: + :param abstract: + :param mixed: + :param default_attributes_apply: """ name: Optional[str] = attribute() @@ -1010,14 +961,9 @@ def is_mixed(self) -> bool: @dataclass class Field(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param xpath: a subset of XPath expression """ xpath: Optional[str] = attribute() @@ -1025,31 +971,22 @@ class Field(AnnotationBase): @dataclass class Selector(Field): - """ - - Content: (annotation?) - - """ + """Schema Model.""" @dataclass class Unique(AnnotationBase): """ - - Content: (annotation?, (selector, field+)?) - + Schema Model. + + :param name: NCName + :param ref: QName + :param selector: + :param fields: """ name: Optional[str] = attribute() + ref: Optional[str] = attribute() selector: Optional[Selector] = element() fields: Array[Field] = array_element(name="field") @@ -1057,16 +994,16 @@ class Unique(AnnotationBase): @dataclass class Key(AnnotationBase): """ - - Content: (annotation?, (selector, field+)?) - + Schema Model. + + :param name: NCName + :param ref: QName + :param selector: + :param fields: """ name: Optional[str] = attribute() + ref: Optional[str] = attribute() selector: Optional[Selector] = element() fields: Array[Selector] = array_element(name="field") @@ -1074,17 +1011,17 @@ class Key(AnnotationBase): @dataclass class Keyref(AnnotationBase): """ - - Content: (annotation?, (selector, field+)?) - + Schema Model. + + :param name: NCName + :param ref: QName + :param refer: QName + :param selector: + :param fields: """ name: Optional[str] = attribute() + ref: Optional[str] = attribute() refer: Optional[str] = attribute() selector: Optional[Selector] = element() fields: Array[Selector] = array_element(name="field") @@ -1093,15 +1030,12 @@ class Keyref(AnnotationBase): @dataclass class Alternative(AnnotationBase): """ - - Content: (annotation?, (simpleType | complexType)?) - + Schema Model. + + :param type: QName + :param test: an XPath expression + :param simple_type: + :param complex_type: """ type: Optional[str] = attribute() @@ -1121,26 +1055,28 @@ def real_name(self) -> str: @dataclass class Element(AnnotationBase): """ - - Content: (annotation?, - ((simpleType | complexType)?, alternative*, (unique | key | keyref)*)) - + Schema Model. + + :param name: NCName + :param ref: QName + :param type: QName + :param substitution_group: List of QName + :param default: + :param fixed: + :param form: qualified | unqualified + :param block: (#all | List of (extension | restriction | substitution)) + :param final: (#all | List of (extension | restriction)) + :param target_namespace: anyURI + :param simple_type: + :param complex_type: + :param alternatives: + :param uniques: + :param keys: + :param keyrefs: + :param min_occurs: nonNegativeInteger : 1 + :param max_occurs: (nonNegativeInteger | unbounded) : 1 + :param nillable: + :param abstract: """ name: Optional[str] = attribute() @@ -1223,14 +1159,11 @@ def get_restrictions(self) -> Dict[str, Anything]: @dataclass class Notation(AnnotationBase): """ - - Content: (annotation?) - + Schema Model. + + :param name: NCName + :param public: token + :param system: anyURI """ name: Optional[str] = attribute() @@ -1240,19 +1173,22 @@ class Notation(AnnotationBase): @dataclass class SchemaLocation(AnnotationBase): + """ + Base schema location. + + :param location: any url with a urllib supported scheme file: http: + """ + location: Optional[str] = field(default=None) @dataclass class Import(SchemaLocation): """ - - Content: (annotation?) - + Schema Model. + + :param namespace: anyURI + :param schema_location: anyURI """ namespace: Optional[str] = attribute() @@ -1262,12 +1198,9 @@ class Import(SchemaLocation): @dataclass class Include(SchemaLocation): """ - - Content: (annotation?) - + Schema Model. + + :param schema_location: anyURI """ schema_location: Optional[str] = attribute(name="schemaLocation") @@ -1276,12 +1209,13 @@ class Include(SchemaLocation): @dataclass class Redefine(SchemaLocation): """ - - Content: (annotation | (simpleType | complexType | group | attributeGroup))* - + Schema Model. + + :param schema_location: anyURI + :param simple_types: + :param complex_types: + :param groups: + :param attribute_groups: """ schema_location: Optional[str] = attribute(name="schemaLocation") @@ -1294,15 +1228,16 @@ class Redefine(SchemaLocation): @dataclass class Override(SchemaLocation): """ - - Content: ( - annotation | (simpleType | complexType | group | - attributeGroup | element | attribute | notation) - )* - + Schema Model. + + :param schema_location: anyURI + :param simple_types: + :param complex_types: + :param groups: + :param attribute_groups: + :param elements: + :param attributes: + :param notations: """ schema_location: Optional[str] = attribute(name="schemaLocation") @@ -1318,25 +1253,29 @@ class Override(SchemaLocation): @dataclass class Schema(SchemaLocation): """ - - Content: ( - (include | import | redefine | override | annotation)*, - (defaultOpenContent, annotation*)?, - ((simpleType | complexType | group | attributeGroup | - element | attribute | notation), annotation*)*) - + Schema Model. + + :param target: + :param block_default: (#all | List of (extension | restriction | substitution)) + :param default_attributes: QName + :param final_default: (#all | List of extension | restriction | list | union) : '' + :param target_namespace: anyURI + :param version: token + :param xmlns: + :param element_form_default: (qualified | unqualified) : unqualified + :param attribute_form_default: (qualified | unqualified) : unqualified + :param default_open_content: + :param imports: + :param redefines: + :param overrides: + :param annotations: + :param simple_types: + :param complex_types: + :param groups: + :param attribute_groups: + :param elements: + :param attributes: + :param notations: """ class Meta: