Author: reinhard Date: 2007-02-20 12:49:52 -0600 (Tue, 20 Feb 2007) New Revision: 9386
Modified: trunk/gnue-common/src/definitions/GParser.py Log: Added option to ignore minimum requirements when parsing an XML file, this is helpful to merge in partial files (like translations). Modified: trunk/gnue-common/src/definitions/GParser.py =================================================================== --- trunk/gnue-common/src/definitions/GParser.py 2007-02-14 14:22:19 UTC (rev 9385) +++ trunk/gnue-common/src/definitions/GParser.py 2007-02-20 18:49:52 UTC (rev 9386) @@ -93,7 +93,8 @@ # ----------------------------------------------------------------------------- def loadXMLObject (stream, handler, rootType, xmlFileType, - initialize = True, attributes = {}, initParameters = {}, url = None): + initialize = True, attributes = {}, initParameters = {}, url = None, + checkRequired = True): """ This method loads an object from a XML stream and returns that object. If initialize is True (default), then the object is initialized and ready to go. @@ -129,6 +130,7 @@ url = hasattr (stream, 'url') and stream.url or '[unknown]' dh.url = url + dh.checkRequired = checkRequired dh.parser = parser dh.initValidation () @@ -250,6 +252,7 @@ self.root = None self.url = None self.doImportLayoutParser = True + self.checkRequired = True self._phaseInitCount = 0 self._requiredTags = [] @@ -466,7 +469,7 @@ lattrs[attr] = value = typecast (attrdata['Default']) # Check for missing required attributes - elif attrdata.get('Required', False): + elif self.checkRequired and attrdata.get('Required', False): tm = u_('Error processing <%(tagname)s> tag [required attribute ' '"%(attribute)s" not present]') \ % {'tagname': tname, 'attribute': attr} _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue