示例#1
0
 def convert_from_xml(cls, str_value):
     if str_value not in ('1', '0', 'true', 'false'):
         raise InvalidXmlError(
             "value must be one of '1', '0', 'true' or 'false', got '%s'"
             % str_value
         )
     return str_value in ('1', 'true')
示例#2
0
    def is_empty(self):
        """True if only a single empty `a:p` element is present."""
        ps = self.p_lst
        if len(ps) > 1:
            return False

        if not ps:
            raise InvalidXmlError("p:txBody must have at least one a:p")

        if ps[0].text != "":
            return False
        return True