tefra / xsdata

Naive XML & JSON Bindings for python
https://xsdata.readthedocs.io
MIT License
314 stars 57 forks source link

structure-style namespaces path generation #554

Closed untereiner closed 3 years ago

untereiner commented 3 years ago

Could it be possible to add an option to generate the file not with the namespace as filename but as path ? For example the namespace: http://www.energistics.org/energyml/data/commonv2 For now the cli generate the file: energistics_org_energyml_data_commonv2.py in a target package Could it be possible to generate the path energistics/energyml/data/commonv2.py in a target package ?

Edit: even better use the version tag My schema's header is as follows:

<xs:schema targetNamespace="http://www.energistics.org/energyml/data/resqmlv2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:resqml="http://www.energistics.org/energyml/data/resqmlv2" xmlns:eml="http://www.energistics.org/energyml/data/commonv2" elementFormDefault="qualified" version="2.2">

I would like to generate a path with the version (e.g. "2.2"): energistics/energyml/data/v2.2/commonv2.py

tefra commented 3 years ago

@untereiner you could play around with the module aliases, check the travelport sample

  <Aliases>
    <ModuleName source="http://www.energistics.org/energyml/data/resqmlv2" target="energistics.energyml.data.commonv2"/>
untereiner commented 3 years ago

ok thanks, besides I can add manually the version string because there is no way to get it from the xsd schema, right ?

tefra commented 3 years ago

ok thanks, besides I can add manually the version string because there is no way to get it from the xsd schema, right ?

yes, you can do whatever you want with the aliases, currently there is no other way