| 1127 | } |
| 1128 | |
| 1129 | XMLAttribute* XMLElement::FindOrCreateAttribute(const char* name) { |
| 1130 | XMLAttribute* last = 0; |
| 1131 | XMLAttribute* attrib = 0; |
| 1132 | for (attrib = _rootAttribute; |
| 1133 | attrib; |
| 1134 | last = attrib, attrib = attrib->_next) { |
| 1135 | if (XMLUtil::StringEqual(attrib->Name(), name)) { |
| 1136 | break; |
| 1137 | } |
| 1138 | } |
| 1139 | if (!attrib) { |
| 1140 | attrib = new (_document->_attributePool.Alloc()) XMLAttribute(); |
| 1141 | attrib->_memPool = &_document->_attributePool; |
| 1142 | if (last) { |
| 1143 | last->_next = attrib; |
| 1144 | } else { |
| 1145 | _rootAttribute = attrib; |
| 1146 | } |
| 1147 | attrib->SetName(name); |
| 1148 | attrib->_memPool->SetTracked(); // always created and linked. |
| 1149 | } |
| 1150 | return attrib; |
| 1151 | } |
| 1152 | |
| 1153 | void XMLElement::DeleteAttribute(const char* name) { |
| 1154 | XMLAttribute* prev = 0; |
nothing calls this directly
no test coverage detected