OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] can attribute in XML schema hold value and unit

[ Lists Home | Date Index | Thread Index ]

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@intergraph.com]
Sent: Friday, March 03, 2006 12:24 PM
To: Mangesh Kalbhor; xml-dev@lists.xml.org
Subject: RE: [xml-dev] 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@autodesk.com]
Sent: Friday, March 03, 2006 2:08 PM
To: xml-dev@lists.xml.org
Subject: [xml-dev] 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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS