result_t XmlElement::setAttribute(const char *name, const char *value) { obj_ptr<XmlAttr_base> attr = new XmlAttr(m_document, name, value); obj_ptr<XmlAttr_base> ret; return setAttributeNode(attr, ret); }
Element::Element(Document* pOwnerDocument, const Element& element): AbstractContainerNode(pOwnerDocument, element), _name(pOwnerDocument->namePool().insert(element._name)), _pFirstAttr(0) { Attr* pAttr = element._pFirstAttr; while (pAttr) { Attr* pClonedAttr = static_cast<Attr*>(pAttr->copyNode(false, pOwnerDocument)); setAttributeNode(pClonedAttr); pClonedAttr->release(); pAttr = static_cast<Attr*>(pAttr->_pNext); } }
void Element::setAttribute(const XMLString& name, const XMLString& value) { Attr* pAttr = getAttributeNode(name); if (pAttr) { pAttr->setValue(value); } else { pAttr = ownerDocument()->createAttribute(name); pAttr->setValue(value); setAttributeNode(pAttr); pAttr->release(); } }