-
Notifications
You must be signed in to change notification settings - Fork 131
Q: Use rfl::Variant / rfl::TaggedUnion with XML tag name. #419
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
Comments
@GregorySech , I don't think you could use variants for that. The only solution I could think of out of the top of my head is this: struct Basket {
std::vector<Banana> Banana;
std::vector<Pineapple> Pineapple;
std::vector<Apple> Apple;
};
|
@liuzicheng1987 thanks for the quick answer, I thought it would have not worked with an XML with unordered tags but today I could try it and it's working! With this solution any written XML will always have the tags grouped by type but for my use case that should be fine. Thank you again! P.S. should I close this issue? It still is highlighting a limitation of the currently implemented XML de-serialization with respect to other formats. In JSON the set of classes presented in the issue works using tagged unions. |
Yeah, please close the issue. I think this is more of a limitation of the XML format. |
Uh oh!
There was an error while loading. Please reload this page.
I would like to (de)serialize XML files that are similar to the following:
I would like to model this using a rfl::Variant / TaggedUnion type like so:
What I'm missing is how can I associate the Variant Tag to the Tag name instead of having the
<Basket>
tag be composed of<fruits \>
tags.Is there some way of doing it?
The text was updated successfully, but these errors were encountered: