A
A
Animkim2017-04-27 13:53:04
XSD
Animkim, 2017-04-27 13:53:04

XSD syntax, is it possible to implement an if else construct?

The question is, is it possible to implement something like this:

Если элемент <frist_name>Вася</> то <last_name></> обязательно к заполнению.
Если элемент <frist_name>СуперВася</> то <last_name></> не обязательно к заполнению.

I read the doc, used Google, with my weak English, I realized that this cannot be done. But I would like to be 100% sure. Maybe someone knows the answer to this question and can immediately give an answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2017-04-27
@Animkim

There are substitution groups. That is, we can say that either such content is valid, or such. I think this is a good example of using groups: stackoverflow.com/questions/39868769/xsd-element-s...
But are you sure you should use XSD for this task? This should also be a means of formal validation. That is, if your component received a valid XSD as input, it means that it can parse such a document. And even then you can conduct business validation, check invariants, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question