Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to design xsd schema for two common elements with different input data?
    primarykey
    data
    text
    <p>I need an advice how to design <strong>xsd schema</strong> to represent objects.</p> <p>I have a such interface</p> <pre><code>public interface Validator{ boolean validate(Q query); } </code></pre> <p>And I have some implementations - </p> <pre><code>public class SimpleValidator implements Validator{ private R param; public boolean validate(Q Query){ //some logic with using param } public void setParam(R param){ this.param = param; } } public class AnotherValidator implements Validator{ private Data data1; private Data data1; public boolean validate(Q Query){ //some logic with using data1 and data2 } public void setData1(Data data1){ this.data1 = data1; } public void setData2(Data data2){ this.data2 = data2; } } </code></pre> <p>I have such decision - </p> <p>I create root element - <code>&lt;xsd:element name="validator" type="validatorType"/&gt;</code></p> <p>And such elements - </p> <pre><code>&lt;xsd:element name="simpleValidator" type="simpleValidatorType" substitutionGroup="validator"/&gt; &lt;xsd:element name="anotherValidator" type="anotherValidatorType" substitutionGroup="validator"/&gt; </code></pre> <p>Now I can use tags <code>simpleValidator</code> and <code>anotherValidator</code> in the place where is needing <code>validator</code>. Example - </p> <pre><code>&lt;anotherValidator&gt; &lt;data1 value="value1"/&gt; &lt;data2 value="value2"/&gt; &lt;/anotherValidator&gt; </code></pre> <p>The problem is, that I want to use only tag <code>validator</code>. As example, I want something like this - </p> <pre><code>&lt;validator type="simpleValidator&gt; //simpleValidator data &lt;/validator&gt; &lt;validator type="anotherValidator&gt; //anotherValidator data &lt;/validator&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload