changeset 2777:72604c3a3ed9

Added schema layouts for #138
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Fri, 21 Apr 2017 14:46:16 +0100
parents d6e496b0a5a9
children 80c95ab21220
files js/specification.js xml/test-schema.xsd
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/js/specification.js	Fri Apr 21 14:28:26 2017 +0100
+++ b/js/specification.js	Fri Apr 21 14:46:16 2017 +0100
@@ -415,6 +415,7 @@
     this.interfaceNode = function (specification) {
         this.title = undefined;
         this.name = undefined;
+        this.image = undefined;
         this.options = [];
         this.scales = [];
         this.schema = schemaRoot.getAllElementsByName('interface')[1];
@@ -443,7 +444,11 @@
                 }
                 this.options.push(option);
             }
-
+            // Get the image node
+            var imageNode = xml.getElementsByTagName("image");
+            if (imageNode.length == 1) {
+                this.image = imageNode[0].getAttribute("src");
+            }
             // Now the scales nodes
             var scaleParent = xml.getElementsByTagName('scales');
             if (scaleParent.length == 1) {
@@ -790,6 +795,7 @@
             this.startTime = undefined;
             this.stopTime = undefined;
             this.sampleRate = undefined;
+            this.image = undefined;
             this.alternatives = [];
             this.schema = schemaRoot.getAllElementsByName('audioelement')[0];
             this.parent = undefined;
--- a/xml/test-schema.xsd	Fri Apr 21 14:28:26 2017 +0100
+++ b/xml/test-schema.xsd	Fri Apr 21 14:46:16 2017 +0100
@@ -28,7 +28,7 @@
         </xs:attribute>
 
         <xs:attribute name="playOne" type="xs:boolean" default="false" />
-        
+
         <xs:attribute name="minWait" type="xs:nonNegativeInteger" default="0" />
 
         <!-- define complex elements-->
@@ -122,6 +122,11 @@
             <xs:complexType>
                 <xs:sequence>
                     <xs:element ref="title" minOccurs="0" maxOccurs="1" />
+                    <xs:element name="image" minOccurs="0" maxOccurs="1">
+                        <xs:complexType>
+                            <xs:attribute name="src" type="xs:anyURI" use="required" />
+                        </xs:complexType>
+                    </xs:element>
                     <xs:element name="interfaceoption" minOccurs="0" maxOccurs="unbounded">
                         <xs:complexType>
                             <xs:attribute name="type" use="required">
@@ -229,6 +234,7 @@
                         </xs:restriction>
                     </xs:simpleType>
                 </xs:attribute>
+                <xs:attribute name="image" type="xs:anyURI" use="optional" />
             </xs:complexType>
         </xs:element>