2011-05-23 121 views
0

我需要一个模式限制满足以下条件:位置XML架构限制

  • 名单,由+或前缀 - 分离用空格字符

    例:+ Z * 1 + FR -PAR

可能的位置类型:

  • 地区:Z * 1,Z * 2,Z * 3
  • ATPCO区:3个NUMERICS
  • 国家:2个alphanums
  • 市:3个alphanums
  • 州/省​​:2阿尔法/ 2阿尔法
  • 地区:5个阿尔法或4的α+ 1个从1至5
  • IATA分区民:2个NUMERICS

回答

0

的XSD列表类型允许空位分隔项目。下面将让所有的话:

<simpleType name='locations'> 
    <list itemType='string'/> 
</simpleType> 

你可以使用正则表达式的所有字符串限制与+或启动 -

<simpleType name='location'> 
    <restriction base='string'> 
     <pattern value='[\+\-]\w'/> 
    </restriction> 
</simpleType> 

<simpleType name='locations'> 
    <list itemType='location'/> 
</simpleType> 
+0

感谢理查德。 – Ankit 2011-05-23 08:16:41

+0

乐于帮助。祝你好运。 – 2011-05-23 08:47:37