← Prev in month ← Prev in thread
Next in thread → Next in month →

Re: [unitsml] RE: A question re: using XML validation for ensuringproper units used in instance document

From
Martin S. Weber <>
Date
2009-09-15T20:59:27+00:00
ID
Thread
Re: [unitsml] RE: A question re: using XML validation for ensuringproper units used in instance document
Deborra,

"what Robert said", and furthermore: Depending on what you mean with "standard 
XML validation", a XSLT application might be helpful too. As Robert has 
pointed out, the units carry a QuantityReference element (and the quantities a 
UnitReference), so there are a few options:

- Use your custom "DB" to enlist all fitting units for a specified quantity 
(via UnitReference items on the Quantity elements). Then a user can select one 
of the list of quantities (weight, length etc.) and for the second selection 
(that of the unit) only those units pointed to by the UnitReference children 
of that chosen quantity might be offered.
- Use an XSLT application (some schema validators ultimately break down to 
XSLT application, depending on what you use this might be easiest) to ensure 
that in a specific field only a unit is entered that has a QuantityReference 
to the Quantity you are expecting. Say, something like,
  <!-- in a units template -->
  <xsl:if test="document(QuantityReference/@url)/@xml:id = $expectedQ/@xml:id)">
  <!-- ... -->
  </xsl:if>
or
  <xsl:if test="document(QuantityReference/@url)/QuantityName = 'length'">
  <!-- ... -->
  </xsl:if

As you can see, the reference elements, if properly entered in the DB you use, 
can serve to ensure integrity by either means (application development side or 
validation side).

Hope that helps,

Regards,

-Martin
← Prev in month ← Prev in thread
Next in thread → Next in month →