Next in thread → Next in month →

RE: [xml-dev] Validation help

From
Michael Kay <>
To
'Carlos Narváez' <>,
Date
2007-08-25T07:47:04Z
ID
<004701c7e6ec$21263190$6401a8c0@turtle>
Thread
RE: [xml-dev] Validation help
Define wordType as an extension of ns1:word, where ns1:word is a simple type
derived by restriction from xs:string with the facet <xs:pattern
value="\w+"/>.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Carlos Narváez [mailto:] 
> Sent: 25 August 2007 06:07
> To: 
> Subject: [xml-dev] Validation help
> 
> Hi:
> 
> I have a question about validation.
> This is the xml fragment I want to validate:
> 
> <word syllables="2">arrow</word>
> 
> This is my current complexType for it:
> 
> <xs:complexType name="wordType">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute name="syllables" type="ns1:lowint" 
> use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType>
> 
> This schema is adequately diligent with the attribute (using 
> a customized "lowint" type which only allows integers from 1 
> to 7), but I want constraints on the contents of the element 
> as well. For one thing, it may not be empty, and must match a 
> "[\w]+" pattern (alphanumeric, no punctuation or whitespace)
> 
> the finished schema should not validate the following invalid 
> xml fragments:
> 
> <word syllables="2"></word>
> <word syllables="2">1 .23</word>
> <word syllables="2">two words</word>
> 
> I'm pretty new to schema... I'm fumbling with it. I've tried 
> dozens of combinations to get this to validate
> 
> Thanks.
> 
> --
> http://www.juegopixel.com
> http://www.aerolineasmexicanas.com.mx/
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: 
> subscribe:  List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
Next in thread → Next in month →