-
Notifications
You must be signed in to change notification settings - Fork 180
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
Question: support for xs:Alternative? #511
Comments
There is no specific support that would create code to enforce the attribute presence/absence. But I think the classes with properties for the attributes should be generated regardless. You would have to set the attribute values from user code according to the rules in the schema. Do you have an example schema file? |
Thanks so much for reply! Our customer provided us only with .doc-specification stating that different attributes should be used based on the value of another attribute. An xml sample could look like this
They were unable to provide an xsd-schema, so I was trying to create a schema file and so far I've come up with this
Since no model file is generated for this schema file by usning xscgen, my other option is to declare all three attributes (Limits, LowLimit and UpLimit) as optional on Node-element and then set them according to the business rules in our code. That was also what your answer suggested, if I understood it correctly? |
I'm getting Yes, what you describe in the last paragraph is exactly what I meant. |
I also apologize for posting a questions here, but I cannot find any answers elsewhere.
Is it correctly understood that xcsgen does not support xs:alternative?
I need to switch the attributes depending on the value of another attribute. E.g. if the value of attribute "type" is 1 then attributes UpLimit and LowLimit should be present, otherwise only attribute Limits should be present.
The solution I found was based on use of the xs:alternative, but when I use xscgen on my xsd file, no model file is generated.
Thanks for the help in advance!
The text was updated successfully, but these errors were encountered: