Regular expressions may work to some degree in this case, but they won't
provide the level of validation for units that you need. For example, a regular
expression can be used to define the format for a date, but it cannot validate
that a date of (for example) February 30 is not present, as it cannot validate
the combination of month and year in this case.
So Len's example of an attribute for units, with an enumerated list of
valid values, is the best approach.
Joe
Kind Regards,
Joseph Chiusano
Associate
Booz Allen Hamilton
700 13th St. NW, Suite 1100
Washington, DC 20005
O: 202-508-6514
C: 202-251-0731
Hi Mangesh,
You can have this in Schema.
Define simple type attribute and have a regular expression
as the constraint on that simple type attribute according to your data+units
combination.
-Sreeni
Hi All,
I am creating a xml schema where I
have to making a ‘attribute’ but can a attribute hold a value and
unit.
My example is FlowRate, let’s the
value and unit could be 100 GPM.
Can I have just one attribute for
100 and GPM both. Some times it might be 80 cFPS.
So can a attribute hold both or do I
need element here.
Thanks,
Mangesh
|