[relaxng-user] How to match any string _except_ s1, s2, s3 ?

Ken Beesley Ken.Beesley at xrce.xerox.com
Fri Jan 9 17:38:05 ICT 2004


Question:  How to match any string _except_ s1, s2, s3 ?


In RELAX NG, is there a way to match any string-type
attribute value _except_ an enumerated list of values?

I.e. a _positive_ enumeration, to match either
title="Root" or title="root" might be

<attribute name="title">
  <data type="string">
    <choice>
      <value>Root</value>
      <value>root</value>
    </choice>
  </data>
</attribute>

or

<attribute name="title">
  <data type="string">
    <param name="pattern">[Rr]oot</param>
  </data>
</attribute>

but what if you want to match title="AnyStringHere" but
with the added condition that "AnyStringHere" _not_ be
"root" or "Root"?  One might imagine an <exclude> element, e.g.

<!-- WARNING:  pseudo RELAX NG schema -->
<attribute name="title">
  <data type="string">
    <exclude>
      <value>Root</value>
      <value>root</value>
    </exclude>
  </data>
</attribute>

Or, one could imagine negative pattern matching, e.g.

<!-- WARNING:  pseudo RELAX NG schema -->
<attribute name="title">
  <data type="string">
    <param name="negativePattern">[Rr]oot</param>
  </data>
</attribute>

Is there anything like this available?  Have I missed something?

Ken


**********************************************************************
Kenneth R. Beesley		ken.beesley at xrce.xerox.com 
Xerox Research Centre Europe    Tel from France:    04  76 61 50 64  	
6, chemin de Maupertuis		Tel from Abroad: +33 4  76 61 50 64
38240 MEYLAN			Fax from France:    04  76 61 50 99
France				Fax from Abroad: +33 4  76 61 50 99

XRCE page:      http://www.xrce.xerox.com
Personal page:  http://www.xrce.xerox.com/people/beesley/beesley.html
**********************************************************************



More information about the relaxng-user mailing list