I have a requirement where I am trying to define require fields (minOccurs=1) based on other field value in XSD but not able to do so.
I am trying to give simple example to understand my problem a bit more. Please refer below two simple xml where state
is the field which defines what event occured. I need to define processingTime
and processResult
as required fields in XSD file if state
field value is PROCESS_END
because there is no need of these fields when process starts. This is just simple example to illustrate my problem. Thanks in advance.
<?xml version = "1.0"?>
<metadata>
<title>The processing started event</title>
<state>PROCESS_START</state>
</metadata>
<?xml version = "1.0"?>
<metadata>
<title>The processing ended event</title>
<state>PROCESS_END</state>
<processingTime>100s</processingTime>
<processResult>success</processResult>
</metadata>