Browse Source

Add fileExtensionsType to xsd for CLI

Matt Clarkson 11 years ago
parent
commit
0a1eed753d
1 changed files with 28 additions and 10 deletions
  1. 28 10
      Libs/CommandLineModules/Core/Resources/ctkCmdLineModule.xsd

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

@@ -389,6 +389,32 @@
   
   <!--
   ===================================================================
+    #487: Definition of 'fileExtensions'.
+
+    Before issue #487: 'A comma separated list of allowed file extensions'.
+
+    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.
+
+    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>
+
+  <!--
+  ===================================================================
     GEOMETRY PARAMETER 
       Extends multipleType for geometry parameters (geometry).
   ===================================================================
@@ -396,11 +422,7 @@
   <xsd:complexType name="geometryType">
     <xsd:complexContent>
       <xsd:extension base="multipleType">
-        <xsd:attribute name="fileExtensions" type="xsd:string">
-          <xsd:annotation>
-            <xsd:documentation>A comma separated list of allowed file extensions.</xsd:documentation>
-          </xsd:annotation>
-        </xsd:attribute>
+        <xsd:attribute name="fileExtensions" type="fileExtensionsType"/>
         <xsd:attribute name="type">
           <xsd:annotation>
             <xsd:documentation>Optionally specifies the allowed geometry type.</xsd:documentation>
@@ -426,11 +448,7 @@
   <xsd:complexType name="fileType">
     <xsd:complexContent>
       <xsd:extension base="multipleType">
-        <xsd:attribute name="fileExtensions" type="xsd:string">
-          <xsd:annotation>
-            <xsd:documentation>A comma separated list of allowed file extensions (e.g. "nrrd,mhd").</xsd:documentation>
-          </xsd:annotation>
-        </xsd:attribute>
+      <xsd:attribute name="fileExtensions" type="fileExtensionsType"/>
       </xsd:extension>
     </xsd:complexContent>
   </xsd:complexType>