tags:

views:

23

answers:

1

I all, given the following piece of xml, what would the xsd look like that would ensure chema validation failed if MortgageProductInterestRateCollarLimitPct was greater than MortgageProductInterestRateCappedLimitPct?

<MortgageInterestRate>
  <MortgageInterestRatePercentage>1.99</MortgageInterestRatePercentage> 
  <MortgageInterestRatePeriodInMonths>0</MortgageInterestRatePeriodInMonths> 
  <MortgageInterestRateTypeCode>V</MortgageInterestRateTypeCode> 
  <MortgageInterestRateTierName>Standard Mortgage Rate</MortgageInterestRateTierName> 
  <MortgageProductInterestRateLoadingPct>0.00</MortgageProductInterestRateLoadingPct> 
  <MortgageProductInterestRateBaseRateTypeCode>4</MortgageProductInterestRateBaseRateTypeCode> 
  <MortgageProductInterestRateCappedLimitPct>234534<MortgageProductInterestRateCappedLimitPct /> 
  <MortgageProductInterestRateCollarLimitPct>654<MortgageProductInterestRateCollarLimitPct /> 
</MortgageInterestRate>

Thanks

+2  A: 

That's a type of validation that XML Schema cannot handle. You can define structural restrictions, and restriction on individual nodes and their values - but you cannot get checks that depends on other nodes and their values.

For that, you'd have to look at other XML validation mechanisms like Schematron or others.

Marc

marc_s