Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XML Validation - Info required

$
0
0

In the below xml, I have 3 car groups G1, G2, G3. Each car group has a set of car specification. 
When a car is assigned to a particular group then it can have only the specs of that group.
e.g. G1 group --> 1, 2, 3
      G2 group --> 2, 3, 4

<CarGroups>
<CarGroup id="G1">
<Name resourceId ="Ferrari"/>
</CarGroup>
<CarGroup id="G2">
<Name resourceId ="Honda"/>
</CarGroup>
<CarGroup id="G3">
<Name resourceId ="McLaren"/>
</CarGroup>
</CarGroups>

<Cars>
<Car>
<CarGroupRef id="G1" />
<CarSpec>
1, 2, 3
</CarSpec>
</Car>
<Car>
<CarGroupRef id="G1" />
<CarSpec>
1, 2, 3
</CarSpec>
</Car>
<Car>
<CarGroupRef id="G2" />
<CarSpec>
  2, 3, 4
</CarSpec>
</Car>
</Cars>

User creates the below Car definition in xml :
<Car>
<CarGroupRef id="G1" />
<CarSpec>
1, 2, 3
</CarSpec>
</Car>
User creates another car definition :
<Car>
<CarGroupRef id="G1" />
<CarSpec>
2, 3, 4
</CarSpec>
</Car>

I need to show an error with this definition as G1 group can have only 1, 2, 3 as specs (as defined in first definition).
Is there a way to put a validation which will validate the xml between different Car definition that user provides ? 
(The car specs come from user, so I am not sure whether the validation can be handled in a xsd. 
Validation should start once client enters wrong specs in second definition taking reference of the first definition.)



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>