Commits

Pete Gadomski committed b10fb7d

Added mike's restrictions

  • Participants
  • Parent commits 40bbde8

Comments (0)

Files changed (17)

examples/filter.xml

+<Pipeline>
+    <Filter type="foo">
+        <Reader type="foo"></Reader>
+    </Filter>
+</Pipeline>

examples/filters.xml

-<WriterPipeline>
-    <Writer type="drivers.las.writer">
-        <Option name="filename">out.las</Option>
-        <Filter type="filters.foo">
-            <Option name="dial">1.1</Option>
-            <Reader type="drivers.las.reader">
-                <Option name="filename">in.las</Option>
-            </Reader>
-        </Filter>
-    </Writer>
-</WriterPipeline>

examples/fullwithoptions.xml

+<Pipeline>
+    <Writer type="foo">
+        <MultiFilter type="foo">
+            <Option name="bar"></Option>
+            <Reader type="foo">
+                <Option name="bar"></Option>
+            </Reader>
+            <Filter type="foo">
+                <Option name="bar"></Option>
+                <Reader type="foo" />
+            </Filter>
+        </MultiFilter>
+    </Writer>
+</Pipeline>

examples/las.xml

-<WriterPipeline>
-    <Writer type="drivers.las.writer">
-        <Option name="filename">out.las</Option>
-        <Reader type="drivers.las.reader">
-            <Option name="filename">in.las</Option>
-        </Reader>
-    </Writer>
-</WriterPipeline>

examples/minimum.xml

-<WriterPipeline>
-    <Writer type="foo">
-        <Reader type="bar" />
-    </Writer>
-</WriterPipeline>

examples/missingoptionname.xml

+<Pipeline>
+    <Reader type="foo">
+        <Option></Option>
+    </Reader>
+</Pipeline>

examples/missingstagetype.xml

+<Pipeline>
+    <Reader />
+</Pipeline>

examples/missingwritertype.xml

+<Pipeline>
+    <Writer>
+        <Reader type="foo" />
+    </Writer>
+</Pipeline>

examples/multifilter.xml

+<Pipeline>
+    <MultiFilter type="foo">
+        <Reader type="foo" />
+        <Reader type="bar" />
+    </MultiFilter>
+</Pipeline>

examples/noreader.xml

-<WriterPipeline>
-    <Writer type="foo">
-    </Writer>
-</WriterPipeline>

examples/nowriter.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<WriterPipeline>
-    <Reader type="drivers.las.reader">
-        <Option name="filename">in.las</Option>
-    </Reader>
-</WriterPipeline>

examples/nowritertype.xml

-<WriterPipeline>
-    <Writer>
-        <Reader type="bar" />
-    </Writer>
-</WriterPipeline>

examples/optionslast.xml

+<Pipeline>
+    <Writer type="foo">
+        <Reader type="foo" />
+        <Option name="bar" />
+    </Writer>
+</Pipeline>

examples/reader.xml

+<Pipeline>
+    <Reader type="foo" />
+</Pipeline>

examples/writer.xml

+<Pipeline>
+    <Writer type="foo">
+        <Reader type="foo"></Reader>
+    </Writer>
+</Pipeline>
         xml = etree.parse(path)
         return xmlschema.validate(xml)
 
-    def test_min(self):
-        self.assert_valid('examples/minimum.xml')
+    def test_reader(self):
+        self.assert_valid('examples/reader.xml')
+
+    def test_writer(self):
+        self.assert_valid('examples/writer.xml')
 
     def test_filter(self):
-        self.assert_valid('examples/filters.xml')
+        self.assert_valid('examples/filter.xml')
 
-    def test_no_writer_type(self):
-        assert not self.validate('examples/nowritertype.xml')
+    def test_multifilter(self):
+        self.assert_valid('examples/multifilter.xml')
 
-    def test_las(self):
-        self.assert_valid('examples/las.xml')
+    def test_fullwithoptions(self):
+        self.assert_valid('examples/fullwithoptions.xml')
 
-    def test_invalid(self):
-        assert not self.validate('examples/nowriter.xml')
+    # def test_optionslast(self):
+        # self.assert_valid('examples/optionslast.xml')
 
-    def test_no_reader(self):
-        assert not self.validate('examples/noreader.xml')
+    def test_missingoptionname(self):
+        assert not self.validate('examples/missingoptionname.xml')
+
+    def test_missingstagetype(self):
+        assert not self.validate('examples/missingstagetype.xml')
+
+    def test_missingwritertype(self):
+        assert not self.validate('examples/missingwritertype.xml')

writerpipeline.xsd

+<?xml version="1.0" encoding="UTF-8"?>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-    <xsd:element name="WriterPipeline">
-        <xsd:complexType>
-            <xsd:sequence>
-                <xsd:element name="Writer" type="StageType" />
-            </xsd:sequence>
-        </xsd:complexType>
-    </xsd:element>
 
-    <xsd:complexType name="StageType">
-        <xsd:sequence>
-            <xsd:element name="Option" type="OptionType" minOccurs="0" />
-            <xsd:choice>
-                <xsd:element name="Reader" type="ReaderType" />
-                <xsd:element name="Filter" type="StageType" />
-            </xsd:choice>
-        </xsd:sequence>
-        <xsd:attribute name="type" type="xsd:string" use="required" />
+    <xsd:element name="Pipeline" type="PipelineType" />
+
+    <xsd:complexType name="PipelineType">
+        <xsd:choice>
+            <xsd:element name="Writer" type="WriterType" />
+            <xsd:element name="Reader" type="ReaderType" />
+            <xsd:element name="Filter" type="FilterType" />
+            <xsd:element name="MultiFilter" type="MultiFilterType" />
+        </xsd:choice>
     </xsd:complexType>
 
-    <xsd:complexType name="ReaderType">
+    <xsd:complexType name="TypeAndOptionsType">
         <xsd:sequence>
-            <xsd:element name="Option" type="OptionType" minOccurs="0" />
+            <xsd:element name="Option" type="OptionType" minOccurs="0" maxOccurs="unbounded" />
         </xsd:sequence>
         <xsd:attribute name="type" type="xsd:string" use="required" />
     </xsd:complexType>
     <xsd:complexType name="OptionType" mixed="true">
         <xsd:attribute name="name" type="xsd:string" use="required" />
     </xsd:complexType>
+
+    <xsd:complexType name="StageType">
+        <xsd:complexContent>
+            <xsd:extension base="TypeAndOptionsType" />
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="WriterType">
+        <xsd:complexContent>
+            <xsd:extension base="TypeAndOptionsType">
+                <xsd:choice>
+                    <xsd:element name="Reader" type="ReaderType" />
+                    <xsd:element name="Filter" type="FilterType" />
+                    <xsd:element name="MultiFilter" type="MultiFilterType" />
+                </xsd:choice>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="ReaderType">
+        <xsd:complexContent>
+            <xsd:extension base="StageType" />
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="FilterType">
+        <xsd:complexContent>
+            <xsd:extension base="StageType">
+                <xsd:choice>
+                    <xsd:element name="Reader" type="ReaderType" />
+                    <xsd:element name="Filter" type="FilterType" />
+                    <xsd:element name="MultiFilter" type="MultiFilterType" />
+                </xsd:choice>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="MultiFilterType">
+        <xsd:complexContent>
+            <xsd:extension base="StageType">
+                <xsd:choice maxOccurs="unbounded">
+                    <xsd:element name="Reader" type="ReaderType" />
+                    <xsd:element name="Filter" type="FilterType" />
+                    <xsd:element name="MultiFilter" type="MultiFilterType" />
+                </xsd:choice>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+    
 </xsd:schema>