瀏覽代碼

Define fileExtensions as attribute with restriction

Matt Clarkson 10 年之前
父節點
當前提交
90083b803b
共有 1 個文件被更改,包括 10 次插入14 次删除
  1. 10 14
      Libs/CommandLineModules/Core/Resources/ctkCmdLineModule.xsd

+ 10 - 14
Libs/CommandLineModules/Core/Resources/ctkCmdLineModule.xsd

@@ -396,22 +396,18 @@
     Slicer uses extensions with dots, but no leading asterisk.
     i.e. ".nii,.nrrd,.mha"
 
-    This should be considered the 'minimal/default specification'.
-    But most platforms should use defensive programming to cope with
-    either an additional asterisk or lack of a leading dot.
+    In CTK, the leading dot is optional. Any preceding asterisk is forbidden.
 
-    So, here we define a regexp restriction to include asterisk and leading dot.
   ===================================================================
   -->
 
-  <xsd:simpleType name="fileExtensionsType">
-    <xsd:annotation>
-      <xsd:documentation>A comma separated list of allowed file extensions.</xsd:documentation>
-    </xsd:annotation>
-    <xsd:restriction base="xsd:token">
-      <xsd:pattern value="^((\*\.|\.)?[^\*]*)(,(\*\.|\.)?[^\*]*)*$"/>
-    </xsd:restriction>
-  </xsd:simpleType>
+  <xsd:attribute name="fileExtensions">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:string">
+        <xsd:pattern value="(?:(?:\.[^,\s]|[^,\.\s\*])[^,\s]*)(?:,\s*(?:\.[^,\s]|[^,\.\s\*])[^,\s]*)*"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
 
   <!--
   ===================================================================
@@ -422,7 +418,7 @@
   <xsd:complexType name="geometryType">
     <xsd:complexContent>
       <xsd:extension base="multipleType">
-        <xsd:attribute name="fileExtensions" type="fileExtensionsType"/>
+        <xsd:attribute ref="fileExtensions"/>
         <xsd:attribute name="type">
           <xsd:annotation>
             <xsd:documentation>Optionally specifies the allowed geometry type.</xsd:documentation>
@@ -448,7 +444,7 @@
   <xsd:complexType name="fileType">
     <xsd:complexContent>
       <xsd:extension base="multipleType">
-      <xsd:attribute name="fileExtensions" type="fileExtensionsType"/>
+      <xsd:attribute ref="fileExtensions"/>
       </xsd:extension>
     </xsd:complexContent>
   </xsd:complexType>