- From: <Simon.Cox@csiro.au>
- Date: Tue, 14 May 2002 09:53:55 +0800
- To: jeni@jenitennison.com, cpaussa@myrealbox.com
- Cc: xmlschema-dev@w3.org
You are trying to encode two pieces of imformation - amount and scale. The underlying principle of XML is that all items belong in separate nodes. So better to use a complex type - either a complex type with several elements in its content model e.g. <length> <amount>2.54</amount> <scale>cm</scale> </length> or a complex type with simpleContent and using an XML attribute for the scale <length uom="in">1.0</length> The type of scale or uom (units of measure) should be a string restricted by an enumeration <xs:simpleType name="lengthUnits"> <xs:restriction base="xs:string"> <xs:enumeration value="px"/> <xs:enumeration value="pt"/> <xs:enumeration value="mm"/> <xs:enumeration value="cm"/> <xs:enumeration value="in"/> <xs:enumeration value="em"/> </xs:restriction> </xs:simpleType> _____ [This mail represents part of a discussion of work in progress and should not be used for any purpose without my permission.] _____ Simon.Cox@csiro.au CSIRO Exploration & Mining 26 Dick Perry Avenue, Kensington WA 6151 PO Box 1130, Bentley WA 6102 AUSTRALIA T: +61 (8) 6436 8639 F: +61 (8) 6436 8555 C: +61 (4) 0330 2672 http://www.csiro.au/page.asp?type=resume&id=CoxSimon > -----Original Message----- > From: Jeni Tennison [mailto:jeni@jenitennison.com] > Sent: Tuesday, 14 May 2002 4:25 AM > To: Chuck Paussa > Cc: xmlschema-dev@w3.org > Subject: Re: <length> = a real number plus a unit qualification > > > Hi Chuck, > > > I'm trying to create a simpleType definition for length, which is > > defined as a real number plus a unit qualification. I've come up > > with this, which I know is wrong. > > > > <simpleType name = "length_Type"> > > <restriction base = "NMTOKEN"> > > <pattern value = "[+-]?\d+\.?\d*[p|m|i|c|e][x|t|m|n]"/> > > </restriction> > > </simpleType> > > > > The unit qualification is one of px, pt, mm, in, cm, em so I > > constructed the above 2 part choice. The problem being it allows > > illegal values such as ix. How do I create a list of atoms greater > > than one character? [px|pt|mm|cm|in|em] is not right. > > You need to use ()s rather than []s. The []s are used when you want to > say "one of this set of characters", so: > > [pmice] > > means one of p, m, i, c or e. > > So you need: > > <simpleType name="length_Type"> > <restriction base="NMTOKEN"> > <pattern value = "[+-]?\d+\.?\d*(px|pt|mm|cm|in|em)"/> > </restriction> > </simpleType> > > Cheers, > > Jeni > > --- > Jeni Tennison > http://www.jenitennison.com/ >
Received on Monday, 13 May 2002 22:05:05 UTC