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

XSD schema generation doesn't parse all nested elements #633

Open
FirefoxMetzger opened this issue Jul 24, 2021 · 2 comments
Open

XSD schema generation doesn't parse all nested elements #633

FirefoxMetzger opened this issue Jul 24, 2021 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@FirefoxMetzger
Copy link
Contributor

The current xmlschema.b parses each X.sdf file and generates an accompanying X.xsd file; however, if any element other than the root element contains a nested <include> tag this tag is ignored. This is because the root element is parsed by the function printXSD, whereas other elements are parsed by printElem and the latter doesn't check for <include> tags.

This is a problem with more recent SDFormat files, which introduce <pose> as a complex type with an optionally nested <relative_to>. Pose is now <include>d, and hence never makes it into the produced .xsd.

The two solutions I can think of are: (1) copy the include parsing code from printXSD to printElem (works, but dirty). Refactor xmlschema.b and merge all code paths that parse element tags.

@FirefoxMetzger FirefoxMetzger added the bug Something isn't working label Jul 24, 2021
@FirefoxMetzger FirefoxMetzger changed the title XSD schema generation doesn't parse nested includes (only top-level) XSD schema generation doesn't parse nested includes (only root-level) Jul 24, 2021
@FirefoxMetzger
Copy link
Contributor Author

FirefoxMetzger commented Jul 25, 2021

The same is true for attributes that don't occur on the root level. An example is imu.sdf and its gravity_dir_x. The sdf specifies a parent_frame attribute, but this is missing from the generated xsd.

@FirefoxMetzger FirefoxMetzger changed the title XSD schema generation doesn't parse nested includes (only root-level) XSD schema generation doesn't parse all nested elements Jul 25, 2021
@chapulina chapulina added the help wanted Extra attention is needed label Jul 26, 2021
@slgrobotics
Copy link

@FirefoxMetzger @chapulina - is there a chance that this bug will be fixed anytime soon? We would like to automatically check validity of SDF files against schema, and this looks impossible as the schemas are incomplete. Any advice would help. Thanks!

(@dagar - FYI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants