| 277 | <xsd:attribute> object |
| 278 | """ |
| 279 | def __init__(self, attribute_elm): |
| 280 | super(Attribute, self).__init__() |
| 281 | self.name = attribute_elm.get('name') |
| 282 | self.type = attribute_elm.get('type') |
| 283 | self.use = attribute_elm.get('use', 'optional') |
| 284 | self.default = attribute_elm.get('default') |
| 285 | self.ref = attribute_elm.get('ref') |
| 286 | self.form = attribute_elm.get('form') |
| 287 | if self.form is not None: |
| 288 | raise TypeError('found xsd:attribute with form="%s"' % self.form) |
| 289 | # don't care about details other than name, ref gives that |
| 290 | if self.name is None: |
| 291 | self.name = self.ref |
| 292 | |
| 293 | def __str__(self): |
| 294 | cardinality = '?' if self.use == 'optional' else '1' |