[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: Restricting attribute content to not include a specific string

From: Huditsch, Roman \(LNG-VIE\) <Roman.Huditsch@lexisnexis.at>
Date: Fri, 21 Apr 2006 09:11:40 +0200
Message-ID: <AB4D914EE3A3254CA8F439925297E4C69FF4D6@LNGVIEEXCP01VB.legal.regn.net>
To: <xmlschema-dev@w3.org>
xsd xs pattern

Hi list,

Thank you very much for all your helpfull input.
Maybe that would be a nice feature for XML Schema 1.1 to allow this kind of "intersect" or "except" statements.
Like for example:

<xsd:attribute name="courtData">
  <xsd:simpleType>
    <xsd:intersect>
      <xsd:simpleType>
        <xsd:restriction base="xsd:string">
          <xsd:whiteSpace value="collapse"/>
        </xsd:restriction>
      </xsd:simpleType>
      <xsd:simpleType>
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value="unknown"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:intersect>
  </xsd:simpleType>
</xsd:attribute>

I suppose that is not the best use case example, but I hope the application of my idea is understandable, though ;)

best regards,
Roman

> -----Ursprüngliche Nachricht-----
> Von: Mary Holstege [mailto:holstege@mathling.com] 
> Gesendet: Donnerstag, 20. April 2006 16:26
> An: Huditsch, Roman (LNG-VIE)
> Betreff: Re: Restricting attribute content to not include a 
> specific string
> 
> 
> Oh wait, I misread your question.  To not include a specific string?
> Regular expressions don't like that kind of constraint, so it 
> gets ugly.  You have to have separate patterns for each 
> possible partial (but non-)match:
> 
> <xs:simpleType name="attrValue">
>    <xs:restriction base="xs:string">
>      <xs:pattern value=""/>
>      <xs:pattern value="[^u].*"/>
>      <xs:pattern value="u[^n].*"/>
>      <xs:pattern value="un[^k].*"/>
>      <xs:pattern value="unk[^n].*"/>
>      <xs:pattern value="unkn[^o].*"/>
>      <xs:pattern value="unkno[^w].*"/>
>      <xs:pattern value="unknow[^n].*"/>
>      <xs:pattern value="unknown.+"/>
>    </xs:restriction>
> </xs:simpleType>
> 
> If you can positively assert the values it is allowed to 
> have, that might be simpler.
> 
> Cheers
> 
> //Mary
> 
Received on Friday, 21 April 2006 07:11:55 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.