[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: can attribute in XML schema hold value and unit
- To: "Sreeni Yetchina -X \(syetchin - Pure Solutions at Cisco\)" <syetchin@c...>,"Mangesh Kalbhor" <Mangesh.Kalbhor@a...>,<xml-dev@l...>
- Subject: RE: can attribute in XML schema hold value and unit
- From: "Chiusano Joseph" <chiusano_joseph@b...>
- Date: Fri, 3 Mar 2006 16:15:26 -0500
- Thread-index: AcY+/iUy37EN2qkESKundHM31UedGAAAoNmwAAEZg+AAAES/kAAAUqjA
- Thread-topic: can attribute in XML schema hold value and unit
Yes, but per my message below, how would you validate using regular
expressions *only* that the date value is not (for example) February
30th?
Joe
Joseph Chiusano
Associate
Booz Allen Hamilton
700 13th St. NW, Suite 1100
Washington, DC 20005
O: 202-508-6514
C: 202-251-0731
If I can remember correctly, I implemented the regular
expression validation of Dates(like Feb28 etc) in the schemas(around 3 years
back). There are bunch of code examples across the web for this. So, we can do
validate the dates or for a given set of values- enumerated data (like days of a
week) etc in the Regular expressions.
The date format decides the validation regular expression
expression(ex: Regular expression for dd-MMM-yyyy is diff from
mm/dd/yyyy)
Thanks,
Sreeni
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
|
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|