Adding support for the new version of xmlclass
authorlbessard
Tue, 22 Jan 2008 11:05:46 +0100
changeset 86 f0a9d74e3b26
parent 85 af97c60e759c
child 87 4de868955ee4
Adding support for the new version of xmlclass
plugger.py
plugins/c_ext/c_ext.py
plugins/canfestival/canfestival.py
--- a/plugger.py	Tue Jan 15 11:07:08 2008 +0100
+++ b/plugger.py	Tue Jan 22 11:05:46 2008 +0100
@@ -19,12 +19,12 @@
         <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
           <xsd:element name="BaseParams">
             <xsd:complexType>
-              <xsd:attribute name="Name" type="xsd:string" use="required" default="__unnamed__"/>
+              <xsd:attribute name="Name" type="xsd:string" use="optional" default="__unnamed__"/>
               <xsd:attribute name="IEC_Channel" type="xsd:integer" use="required"/>
-              <xsd:attribute name="Enabled" type="xsd:boolean" use="required" default="true"/>
+              <xsd:attribute name="Enabled" type="xsd:boolean" use="optional" default="true"/>
             </xsd:complexType>
           </xsd:element>
-        </xsd:schema>""")[0]["BaseParams"]
+        </xsd:schema>""")["BaseParams"]
 
 NameTypeSeparator = '@'
 
@@ -80,7 +80,7 @@
     def _AddParamsMembers(self):
         self.PlugParams = None
         if self.XSD:
-            Classes = GenerateClassesFromXSDstring(self.XSD)[0]
+            Classes = GenerateClassesFromXSDstring(self.XSD)
             Classes = [(name, XSDclass) for name, XSDclass in Classes.items() if XSDclass.IsBaseClass]
             if len(Classes) == 1:
                 name, XSDclass = Classes[0]
@@ -500,10 +500,10 @@
             if os.path.isdir(os.path.join(self.PlugPath(), PlugDir)) and \
                PlugDir.count(NameTypeSeparator) == 1:
                 pname, ptype = PlugDir.split(NameTypeSeparator)
-                try:
-                    self.PlugAddChild(pname, ptype, logger)
-                except Exception, e:
-                    logger.write_error("Could not add child \"%s\", type %s :\n%s\n"%(pname, ptype, str(e)))
+                #try:
+                self.PlugAddChild(pname, ptype, logger)
+                #except Exception, e:
+                #    logger.write_error("Could not add child \"%s\", type %s :\n%s\n"%(pname, ptype, str(e)))
 
 def _GetClassFunction(name):
     def GetRootClass():
@@ -557,43 +557,45 @@
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:element name="BeremizRoot">
         <xsd:complexType>
-          <xsd:element name="TargetType">
-            <xsd:complexType>
-              <xsd:choice>
-                <xsd:element name="Win32">
-                  <xsd:complexType>
-                    <xsd:attribute name="Priority" type="xsd:integer" use="required"/>
-                  </xsd:complexType>
-                </xsd:element>
-                <xsd:element name="Linux">
-                  <xsd:complexType>
-                    <xsd:attribute name="Nice" type="xsd:integer" use="required"/>
-                  </xsd:complexType>
-                </xsd:element>
-                <xsd:element name="Xenomai">
-                  <xsd:complexType>
-                    <xsd:attribute name="xeno-config" type="xsd:string" use="required" default="/usr/xenomai/"/>
-                    <xsd:attribute name="Priority" type="xsd:integer" use="required"/>
-                  </xsd:complexType>
-                </xsd:element>
-                <xsd:element name="RTAI">
-                  <xsd:complexType>
-                    <xsd:attribute name="rtai-config" type="xsd:string" use="required"/>
-                    <xsd:attribute name="Priority" type="xsd:integer" use="required"/>
-                  </xsd:complexType>
-                </xsd:element>
-                <xsd:element name="Library">
-                  <xsd:complexType>
-                    <xsd:attribute name="Dynamic" type="xsd:boolean" use="required" default="true"/>
-                  </xsd:complexType>
-                </xsd:element>
-              </xsd:choice>
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:attribute name="Compiler" type="xsd:string" use="required" default="gcc"/>
-          <xsd:attribute name="CFLAGS" type="xsd:string" use="required" default=""/>
-          <xsd:attribute name="Linker" type="xsd:string" use="required" default="ld"/>
-          <xsd:attribute name="LDFLAGS" type="xsd:string" use="required" default=""/>
+          <xsd:sequence>
+            <xsd:element name="TargetType">
+              <xsd:complexType>
+                <xsd:choice>
+                  <xsd:element name="Win32">
+                    <xsd:complexType>
+                      <xsd:attribute name="Priority" type="xsd:integer" use="required"/>
+                    </xsd:complexType>
+                  </xsd:element>
+                  <xsd:element name="Linux">
+                    <xsd:complexType>
+                      <xsd:attribute name="Nice" type="xsd:integer" use="required"/>
+                    </xsd:complexType>
+                  </xsd:element>
+                  <xsd:element name="Xenomai">
+                    <xsd:complexType>
+                      <xsd:attribute name="xeno_config" type="xsd:string" use="optional" default="/usr/xenomai/"/>
+                      <xsd:attribute name="Priority" type="xsd:integer" use="required"/>
+                    </xsd:complexType>
+                  </xsd:element>
+                  <xsd:element name="RTAI">
+                    <xsd:complexType>
+                      <xsd:attribute name="rtai_config" type="xsd:string" use="required"/>
+                      <xsd:attribute name="Priority" type="xsd:integer" use="required"/>
+                    </xsd:complexType>
+                  </xsd:element>
+                  <xsd:element name="Library">
+                    <xsd:complexType>
+                      <xsd:attribute name="Dynamic" type="xsd:boolean" use="optional" default="true"/>
+                    </xsd:complexType>
+                  </xsd:element>
+                </xsd:choice>
+              </xsd:complexType>
+            </xsd:element>
+          </xsd:sequence>
+          <xsd:attribute name="Compiler" type="xsd:string" use="optional" default="gcc"/>
+          <xsd:attribute name="CFLAGS" type="xsd:string" use="required"/>
+          <xsd:attribute name="Linker" type="xsd:string" use="optional" default="ld"/>
+          <xsd:attribute name="LDFLAGS" type="xsd:string" use="required"/>
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>
--- a/plugins/c_ext/c_ext.py	Tue Jan 15 11:07:08 2008 +0100
+++ b/plugins/c_ext/c_ext.py	Tue Jan 22 11:05:46 2008 +0100
@@ -10,7 +10,7 @@
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:element name="C_Extension">
         <xsd:complexType>
-          <xsd:attribute name="C_Files" type="xsd:string" use="required" default="myfile.c"/>
+          <xsd:attribute name="C_Files" type="xsd:string" use="optional" default="myfile.c"/>
           <xsd:attribute name="CFLAGS" type="xsd:string" use="required"/>
           <xsd:attribute name="LDFLAGS" type="xsd:string" use="required"/>
         </xsd:complexType>
--- a/plugins/canfestival/canfestival.py	Tue Jan 15 11:07:08 2008 +0100
+++ b/plugins/canfestival/canfestival.py	Tue Jan 22 11:05:46 2008 +0100
@@ -26,10 +26,10 @@
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:element name="CanFestivalNode">
         <xsd:complexType>
-          <xsd:attribute name="CAN_Device" type="xsd:string" use="required" />
-          <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="required" />
-          <xsd:attribute name="NodeId" type="xsd:string" use="required" />
-          <xsd:attribute name="Sync_TPDOs" type="xsd:boolean" use="required" default="true"/>
+          <xsd:attribute name="CAN_Device" type="xsd:string" use="required"/>
+          <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="required"/>
+          <xsd:attribute name="NodeId" type="xsd:string" use="required"/>
+          <xsd:attribute name="Sync_TPDOs" type="xsd:boolean" use="optional" default="true"/>
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>
@@ -126,7 +126,7 @@
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:element name="CanFestivalInstance">
         <xsd:complexType>
-          <xsd:attribute name="CAN_Driver" type="xsd:string" use="required" />
+          <xsd:attribute name="CAN_Driver" type="xsd:string" use="required"/>
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>