Changeset 2074


Ignore:
Timestamp:
29/01/07 15:43:18 (13 years ago)
Author:
domlowe
Message:

fixed namespace bug in moles parser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/csml2Moles/molesReadWrite.py

    r2065 r2074  
    4040                                if subsubelem.tag=='{http://www.w3.org/2001/XMLSchema}sequence': 
    4141                                    __addSequence(molesclassname,subsubelem) 
     42 
    4243            if elem.tag == '{http://www.w3.org/2001/XMLSchema}element': 
    4344                '''Look for parents of complex types - sometimes a complexType is declared but does not have a name and 
     
    5051                                if subsubelem.tag=='{http://www.w3.org/2001/XMLSchema}sequence': 
    5152                                    __addSequence(molesclassname,subsubelem) 
     53 
    5254            '''this bit handles the use of types. If some element has a name and a type attribute then if that type is complex it has 
    5355            the same sequence as the type e.g. <xs:element name="dataModelID" type="moles:dgMetadataIDType"> 
     
    7072    def lookupOrder(self, dict,classname): 
    7173        '''takes the attributes in a dictionary and orders them according to the schema sequence''' 
    72         try: 
     74        try:         
    7375            order=self.sequences[classname] 
    74             #print classname 
    75             #print order 
    7676        except KeyError: 
    77             #print 'keyerror %s!'%classname 
    7877            order = [] 
    7978            for key in dict: 
    80                 order.append(dict[key]) # if it can't be found an unordered list is returned from the original dictionary items 
     79                #print key 
     80                if key is not 'schema': 
     81                    if key is not 'ns': 
     82                         order.append(key) # if it can't be found an unordered list is returned from the original dictionary items 
     83            #print 'returning %s'%order 
    8184        return order 
    8285 
     
    128131        else: 
    129132            self.schema=None 
     133        print molesFrag.tag 
    130134        orderedAttribs=schema.lookupOrder(self.__dict__,molesFrag.tag) 
    131135        for item in orderedAttribs: 
    132            #print "item in orderedAttribs is %s" %item 
     136           print "item in orderedAttribs is %s" %item 
    133137           if type(item) is xmlSchema: 
    134138                        continue 
Note: See TracChangeset for help on using the changeset viewer.