2011-05-23 65 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