-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cirucular imports after creating binding for ReqIf schema #206
Comments
I am afraid that's trickier to resolve @ansFourtyTwo, although xml schema allows for circular imports, it's really difficult to tackle especially in python. BTW I also tried the xjc compiler (java) also fails. I will leave this issue open since I definitely want to revisit it but right now you either have to sort the imports manually, which I am not optimistic it's even possible, or to find some sort of tool that cleans up xml schema definitions. |
If your xml files are relatively simple and dont use the full specification you could try to write the @datalcass models on your own. I am sorry, currently I can't offer you a better solution |
I had another idea, maybe offer a way to organize classes per namespace that could do the trick instead of relying to the filepaths of the schemas. |
Notes: By default the cli is using the original schemas structure to assign pacakges and modules to classes. The new option will group all classes by the target namespace they were originally defined and write them in the same module inside the user provided package name.
I wanted to try grouping the classes by the target namespace for some time now, the end result is a more flat structure will less packages and modules but it works like a charm against circular imports 😄 I added a new cli flag
|
Notes: By default the cli is using the original schemas structure to assign classes to packages and modules The new option will group all classes by the target namespace they were originally defined and write them in the same module inside the user provided package name.
Notes: Clean attribute names from prefixes earlier in the SchemaMapper. Bonus: Clean namespaces in wildcard names.
Hi @tefra This solutions works fine. I was able to create the DataClasses and parse a *.reqif file into it. However I ran into some other issues searializing from the DataClasses back to xml. If you don't mind, I'll open a new issue for this, although I already feel a bit bad opening issues all the time. Regarding you apologize: You don't have to! Never! xsData does already an amazing job and seeing you working and improving it is really inspiring. Keep the good work going! Really appriciate it. |
Awesome @ansFourtyTwo yes keep the issues separate please and keep them coming! |
After succesfully creating bindings for the ReqIf schema with
xsdata https://www.omg.org/spec/ReqIF/20110401/reqif.xsd --package reqif_model
I tried to parse an actual *.reqif file into the Dataclasses with following code snippet:
However, the import of the
ReqIf
dataclass fromreqif_model.reqif
module throws anImportError
:It seems like there is an circular import, as the error occures during the second import from
reqif_model.www.w3.org.tr.xhtml_modularization.schema.xhtml_inlpres_1
.The text was updated successfully, but these errors were encountered: