[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: "Bullard, Claude L \(Len\)" <len.bullard@i...>
  • Date: Fri, 3 Mar 2006 14:46:17 -0600
  • Thread-index: AcY+/l2yAFzeEzrwRset0WaeZRuuJgAAGNrwAACKTRAAAHIr0A==
  • Thread-topic: can attribute in XML schema hold value and unit

xml schema attribute enumerated
Correct.  Where there is no choice, that works.   Regex is essentially microparsing and you can
do that anywhere in the pipeline with regex or even string testing in script.  
 
From a general design perspectiveas a producer, If I knew that was coming
I'd try to do these tests prior to getting to the xml if possible.  Validation is a pretty
good late binding test but sometimes that is too late.  Context makes all the difference,
so if I know I am late binding, I prefer a correct-by-construction approach (eg. do it in 
the database client prior to emitting the XML) and weaken the dependence on validation.
On the other hand, if one is the consumer, one probably has no choice and now regexing
is attractive because it localizes the test.
 
len
-----Original Message-----
From: Sreeni Yetchina -X (syetchin - Pure Solutions at Cisco) [mailto:syetchin@c...]
Sent: Friday, March 03, 2006 2:31 PM
To: Bullard, Claude L (Len); Mangesh Kalbhor; xml-dev@l...
Subject: RE: can attribute in XML schema hold value and unit

From the design perspective, I agree with "Len".
The best is to separate these two values(numerical and units) . But this is possible if you are starting the Schema afresh.
but if the XML instance documents are already existing and we need to write a Schema for them and some how to validate, we can follow the method that I narrated in my last email(defining a regular expression constraint on the Simple type of attribute definition in the schema)
Thanks,
Sreeni


From: Bullard, Claude L (Len) [mailto:len.bullard@i...]
Sent: Friday, March 03, 2006 12:24 PM
To: Mangesh Kalbhor; xml-dev@l...
Subject: RE: can attribute in XML schema hold value and unit

 
<FlowRate unitStuff="GPM 100" />
 
The best answer is, don't do that; it's bad design for
reasons that are obvious (esentially, it is a token delimited
list and has all the same problems of production order,
catching errors late, all strings, etc.)
 
Make two attributes: one for unitType and one for unitValue. 
 
<FlowRate unitValue="100" unitType="GPM" />
 
It's clear and better for production and validation.
If these are basic types, say enumeration for the
unitTypes and numbers for the values, attributes will work
but are the least extensible.
 
A FlowRate element with an enumerated attribute for unit type.
 
<FlowRate unit="GPM">100</FlowRate>
 
Dealer's choice but the last one is the most robust.
 
len
-----Original Message-----
From: Mangesh Kalbhor [mailto:Mangesh.Kalbhor@a...]
Sent: Friday, March 03, 2006 2:08 PM
To: xml-dev@l...
Subject: can attribute in XML schema hold value and unit

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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
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.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.