Example #1
0
 def startElement(self, elname, elattr):
     "Handle an event for the beginning of an element."
     attr = {}
     for name, value in elattr.items():
         attr[POM.normalize_unicode(name)] = POM.unescape(value)
     obj = SimpleXMLNode(elname, attr)
     self.stack.append(obj)
Example #2
0
 def startElement(self, name, atts):
     "Handle an event for the beginning of an element."
     try:
         klass = self._get_class(name)
     except AttributeError:
         raise POM.ValidationError("Undefined element tag: " + name)
     attr = {}
     for name, value in atts.items():
         attr[keyword_identifier(POM.normalize_unicode(name))] = POM.unescape(value)
     obj = klass(**attr)
     self.stack.append(obj)
Example #3
0
 def startElement(self, name, atts):
     "Handle an event for the beginning of an element."
     try:
         klass = self._get_class(name)
     except AttributeError:
         raise POM.ValidationError("Undefined element tag: " + name)
     attr = {}
     for name, value in atts.items():
         attr[keyword_identifier(
             POM.normalize_unicode(name))] = POM.unescape(value)
     obj = klass(**attr)
     self.stack.append(obj)
Example #4
0
 def get_identifier(self):
     h = self.__hash__()
     h = h**2 if h < 0 else h  # make non-negative
     return "attrib%s_%s" % (identifier(POM.normalize_unicode(
         self.name)), h)
Example #5
0
 def get_identifier(self):
     h = self.__hash__()
     h = h**2 if h < 0 else h # make non-negative
     return "attrib%s_%s" % (identifier(POM.normalize_unicode(self.name)), h)