hpxmlwg / hpxml

Home Performance XML
https://www.hpxmlonline.com
36 stars 18 forks source link

Use xs:assert to improve validation #250

Open shorowit opened 3 years ago

shorowit commented 3 years ago

As of XML Schema 1.1, there is an <xs:assert> where you can write XPath expressions to increase validation of elements/values.

There are a number of places this would be useful in HPXML. One example is HeatingSystem/AnnualHeatingEfficiency/Value where the only check currently is that the value is >= 0 because it handles different units (e.g., AFUE or HSPF). But for some units (e.g., AFUE), we know the value should also be <= 1, which could be handled by an xs:assert.

shorowit commented 3 years ago

Another example is WaterHeatingSystem/EnergyFactor where you could allow different values for, say, electric storage water heaters vs fossil fuel storage water heaters vs heat pump water heaters.