Append the specified child based on whether it is an element or an attrbuite. @param objects: A (single|collection) of attribute(s) or element(s) to be added as children. @type objects: (L{Element}|L{Attribute}) @return: self @rtype: L{Ele
(self, objects)
| 309 | return Namespace.default |
| 310 | |
| 311 | def append(self, objects): |
| 312 | """ |
| 313 | Append the specified child based on whether it is an |
| 314 | element or an attrbuite. |
| 315 | @param objects: A (single|collection) of attribute(s) or element(s) |
| 316 | to be added as children. |
| 317 | @type objects: (L{Element}|L{Attribute}) |
| 318 | @return: self |
| 319 | @rtype: L{Element} |
| 320 | """ |
| 321 | if not isinstance(objects, (list, tuple)): |
| 322 | objects = (objects,) |
| 323 | for child in objects: |
| 324 | if isinstance(child, Element): |
| 325 | self.children.append(child) |
| 326 | child.parent = self |
| 327 | continue |
| 328 | if isinstance(child, Attribute): |
| 329 | self.attributes.append(child) |
| 330 | child.parent = self |
| 331 | continue |
| 332 | raise Exception('append %s not-valid' % child.__class__.__name__) |
| 333 | return self |
| 334 | |
| 335 | def insert(self, objects, index=0): |
| 336 | """ |