AW: Restricting attribute content to not include a specific string

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 UTC