Skip to content
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

Some example required #142

Open
Smotrov opened this issue Sep 9, 2022 · 2 comments
Open

Some example required #142

Smotrov opened this issue Sep 9, 2022 · 2 comments

Comments

@Smotrov
Copy link

Smotrov commented Sep 9, 2022

It would be really appreciated if you'll share some examples how it is actually possible to to generate RUST code using your parser.
How to convert an XSD file to rust struct? Digging through source code but with no luck yet.

@koolquark
Copy link

Hi,

Here's an example on generating rust code form xsd file.

mkdir data_models
cd data_models
wget https://raw.githubusercontent.com/BroadbandForum/cwmp-data-models/master/cwmp-1-0.xsd   -O  cwmp-1-0.xsd
cd ..
mkdir gen_code
# clone the repo
cd xsd-parser-rs
cargo build
./target/debug/xsd-parser  -i ../data_models/cwmp-1-0.xsd   -o ../gen_code/cwmp_1_0.rs 
  • Any depending xsd files also has to be generated into rust like this.
  • See commented use statements at top of generated rust code
  • xsd-types sub project in the repo has types used in the generated rust code. Your code should include xsd-types

@N8-I
Copy link

N8-I commented Nov 13, 2023

Would be great to get that in the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants