Hey guys,
I just wanted to share my latest project with you. It's a code generator for XML schema called xsd-parser. Feel free to have a look at the code. Any kind of feedback is welcome ![]()
https://crates.io/crates/xsd-parser
Greetings, Bergmann89.
Hey guys,
I just wanted to share my latest project with you. It's a code generator for XML schema called xsd-parser. Feel free to have a look at the code. Any kind of feedback is welcome ![]()
https://crates.io/crates/xsd-parser
Greetings, Bergmann89.
Awesome. Rust really needs better tools for this area.
Hey guys,
I've just released a new version with some major improvements to the generator. Thanks to all that gave some feedback and contributed to the project ![]()
Hey guys,
I published a new version v0.3.0 of my xsd-parser a couple of minutes ago. Beside other fixes and improvements the following points were the main changes for this version:
quick_xml for the generated codeFeel free to have a look. I would love to get some feedback ![]()
How do you deal with inheritance? Do you emit enums for all options? Do you use a trees of enums? Do you use traits?
I saw this code xsd-parser/tests/feature/extension_base at 2eea21c4f32ba560c2af566078b9899461578e2a · Bergmann89/xsd-parser
It seems properties from parent are projected into the child. I was wondering how assignment would work in case of a child being assign to a field of parent type and also downcasting when receiving polymorphic data.
I was wrestling with this in my projects and settled for a complex story as the hierarchy was enormous - little bit of enums, lots of traits, little bit of dynamic types (Maps).
Hey @noclue ![]()
as far as I understand extending (or restricting) a type does not necessarily mean to inherit the extended type from the base type (in case of the restriction this is even wrong). Such types will be renderer as separate type, having the same subset of fields as the base type.
Downcasting one type to another type is only needed for dynamic/abstract types and/or for substitution groups. For them I will generate a suitable trait, that is then implemented by the types of that group. You can find an example for substitution groups here.
The trait does currently not have any methods, it's just used to keep track of the types/groups. It's basically a more advanced core::any::Any. As a possible extension of the tool I could implement getters and setters for the different values of a particular substitution group if you need something like that. With the current implementation you have to check the type id of the actual stored type and cast it manually.
I'm excited to share that, thanks to your support, the project has reached a stable state and version 1.0.0 is now released!
Along with various improvements, bug fixes, and more test cases, the key change is the introduction of a new Renderer trait. This allows other developers to create simple code renderers without handling the full generation process. It uses data from a pre-generated structure, making custom renderer development much easier.
As always, I’d love to hear your feedback! ![]()
Hey guys,
I release a new version of xsd-parser ![]()
This version introduces boxed quick_xml deserializers, significantly reducing stack usage during deserialization and improving stability for deeply nested XML structures. The naming of generated types has also been improved to ensure better readability and consistency across generated code.
Another major enhancement in this release is the ability to split the generated code into multiple module files, making it easier to manage large schemas. It also expands our documentation with advanced examples that demonstrate how to leverage the new features in real-world scenarios.
This release also includes various general bug fixes and improvements to ensure a smoother experience.
Give it a try and let me know what you think ![]()
Hey guys ![]()
I just released v1.2.0 of the crate, and it comes with some nice improvements under the hood and a bunch of new features and fixes. Here’s what’s new:
Renderer step and a DataType model. This makes things more modular and easier to extend.serde-xml-rs 0.7 and 0.8.xs:any and xs:anyAttribute - great for handling flexible or unknown schemas.num types.xs:documentation is now included as Rust doc comments.derive settingsGive it a try and feel free to share feedback or ideas!
Hey guys ![]()
I just released v1.3.0 of the crate!
This version took a bit longer than expected, but it comes packed with many improvements, new features, and important fixes. Here’s what’s new:
Schema modularization: Generated code can now be split into schema-specific modules, making large projects much easier to manage. Schemas also carry meta information now, which helps with inspection and debugging.
Extended type handling: A new option allows the use of the full path for built-in types, ensuring unambiguous references in complex projects. Inline element types are now lazily interpreted for better performance and support for circular extensions. In addition, xs:facet restrictions are now evaluated and applied to simple type definitions, closing a gap in schema validation.
Serializer improvements: Added a new configuration for the quick_xml serializer and updated tests to make use of it, ensuring consistent and reliable behavior.
Bug fixes and stability improvements:
TypeelementFormDefault=qualifiedGive it a try and let me know how it works for you! Feedback and ideas are always welcome. ![]()
Hi @Bergmann89,
I'm currently the maintainer of serde-xml-rs. I've just had a look around the xsd-parser crate and it looks nice.
If ever you are available, I'd love to chat about your experience targeting serde-xml-rs and what suggestions you might have.
Hey everyone! ![]()
I’m excited to announce the release of v1.4.0 of the crate!
This update brings some of the biggest internal improvements so far, along with powerful new customization options and a major cleanup of the runtime architecture.
Here’s what’s new:
Full Customization of Name Generation
The entire naming system has been redesigned from the ground up.
You can now customize how identifiers are formatted and resolved, avoid collisions, handle reserved keywords, and plug in your own naming strategies. This gives you much more control over the structure of the generated code.
New Crate Structure: xsd-parser + xsd-parser-types
To make dependency management simpler, the runtime types have been moved into a new crate: xsd-parser-types.
This keeps the generator lightweight and gives downstream crates far more flexibility in choosing their dependencies and feature flags.
Major Improvements to quick_xml Serialization/Deserialization
The quick_xml backend received a huge refactor. If you rely on quick_xml, this release should make things both faster and more predictable:
xs:any, xs:anyType, CDATA, mixed content, and boxed typesBetter Schema Interpretation and Code Generation
Several real-world schema cases that previously caused trouble are now fully supported. These fixes help ensure that generated code remains stable even for large, complicated schema sets.
xs:anyType with a more precise AnyElementAbsolute Path Support
Both BUILD_IN_ABSOLUTE_PATHS and the new ABSOLUTE_PATHS_INSTEAD_USINGS flag now ensure that all built-in types, traits, and helpers use fully qualified paths.
This removes a whole class of name shadowing issues.
Other Improvements
Some smaller additional changes worth mentioning:
xs:any, substitution groups, enum/union facet handling, and moreGive it a try and let me know how things work for you!
Feedback, ideas, and real-world schemas are always welcome. ![]()
Hello all,
I currently develop a xml sax handler and pipeline.
I will need XSD Parser and serde-xml-rs to complete my devs.
explanation of my actual goals :
I will be glad to discuss xml/sax/xsl/xsd/serde integration, together.
Best Regards,
++
Laurent
Hey Laurent,
I've answered in the github issue ![]()