Inserts a new attribute at specified place inside the node. All attributes after and including the specified attribute are moved one position back. \param where Place where to insert the attribute, or 0 to insert at the back. \param attribute Attribute to insert.
| 1250 | //! \param where Place where to insert the attribute, or 0 to insert at the back. |
| 1251 | //! \param attribute Attribute to insert. |
| 1252 | void insert_attribute(xml_attribute<Ch> *where, xml_attribute<Ch> *attribute) |
| 1253 | { |
| 1254 | assert(!where || where->parent() == this); |
| 1255 | assert(attribute && !attribute->parent()); |
| 1256 | if (where == m_first_attribute) |
| 1257 | prepend_attribute(attribute); |
| 1258 | else if (where == 0) |
| 1259 | append_attribute(attribute); |
| 1260 | else |
| 1261 | { |
| 1262 | attribute->m_prev_attribute = where->m_prev_attribute; |
| 1263 | attribute->m_next_attribute = where; |
| 1264 | where->m_prev_attribute->m_next_attribute = attribute; |
| 1265 | where->m_prev_attribute = attribute; |
| 1266 | attribute->m_parent = this; |
| 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | //! Removes first attribute of the node. |
| 1271 | //! If node has no attributes, behaviour is undefined. |