def openXML(self,filename): version = None xmlroot = parseXMLFile(filename) #'http://autosar.org/3.0.2' namespace = getXMLNamespace(xmlroot) assert (namespace is not None) if namespace == 'http://autosar.org/3.0.2': version = 3.0 if version is None: raise NotImplementedError('unsupported autosar vesion: %s'%namespace) removeNamespace(xmlroot,namespace) self.packageParser = autosar.parser.package_parser.PackageParser(version,self) self.version=version self.xmlroot = xmlroot
def openXML(self, filename): version = None xmlroot = parseXMLFile(filename) #'http://autosar.org/3.0.2' namespace = getXMLNamespace(xmlroot) assert (namespace is not None) if namespace == 'http://autosar.org/3.0.2': version = 3.0 if version is None: raise NotImplementedError('unsupported autosar vesion: %s' % namespace) removeNamespace(xmlroot, namespace) self.packageParser = autosar.parser.package_parser.PackageParser( version, self) self.version = version self.xmlroot = xmlroot
def openXML(self,filename): xmlroot = parseXMLFile(filename) namespace = getXMLNamespace(xmlroot) assert (namespace is not None) (major, minor, patch, schema) = parseAutosarVersionAndSchema(xmlroot) removeNamespace(xmlroot,namespace) self.version=float('%s.%s'%(major,minor)) self.major=major self.minor=minor self.patch=patch self.schema=schema self.xmlroot = xmlroot if self.packageParser is None: self.packageParser = autosar.parser.package_parser.PackageParser(self.version) self._registerDefaultElementParsers(self.packageParser)
def openXML(self,filename): xmlroot = parseXMLFile(filename) namespace = getXMLNamespace(xmlroot) assert (namespace is not None) (major, minor, patch, release, schema) = parseAutosarVersionAndSchema(xmlroot) removeNamespace(xmlroot,namespace) self.version=float('%s.%s'%(major,minor)) self.major = major self.minor = minor self.patch = patch self.release = release self.schema = schema self.xmlroot = xmlroot if self.packageParser is None: self.packageParser = autosar.parser.package_parser.PackageParser(self.version) self._registerDefaultElementParsers(self.packageParser)
def openXML(self, filename): version = None xmlroot = parseXMLFile(filename) namespace = getXMLNamespace(xmlroot) assert (namespace is not None) tmp = namespace.split('/')[-1] result = re.match(r'(\d+\.\d+)', tmp) if result is None: result = re.match(r'r(\d+\.\d+)', tmp) if result is not None: version = float(result.group(1)) if version is None: raise NotImplementedError('unsupported autosar vesion: %s' % namespace) removeNamespace(xmlroot, namespace) self.packageParser = autosar.parser.package_parser.PackageParser( version, self) self.version = version self.xmlroot = xmlroot