Attr* Element::setAttributeNode(Attr* newAttr) { poco_check_ptr (newAttr); if (newAttr->ownerDocument() != ownerDocument()) throw DOMException(DOMException::WRONG_DOCUMENT_ERR); if (newAttr->ownerElement()) throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR); Attr* oldAttr = getAttributeNode(newAttr->name()); if (oldAttr) removeAttributeNode(oldAttr); Attr* pCur = _pFirstAttr; if (pCur) { while (pCur->_pNext) pCur = static_cast<Attr*>(pCur->_pNext); pCur->_pNext = newAttr; } else _pFirstAttr = newAttr; newAttr->duplicate(); newAttr->_pParent = this; if (_pOwner->events()) dispatchAttrModified(newAttr, MutationEvent::ADDITION, EMPTY_STRING, newAttr->getValue()); return oldAttr; }
const XMLString& Element::getAttribute(const XMLString& name) const { Attr* pAttr = getAttributeNode(name); if (pAttr) return pAttr->getValue(); else return EMPTY_STRING; }
result_t XmlElement::getAttribute(const char *name, std::string &retVal) { result_t hr; obj_ptr<XmlAttr_base> attr; hr = getAttributeNode(name, attr); if (hr < 0 || hr == CALL_RETURN_NULL) return hr; return attr->get_nodeValue(retVal); }
void DOMElementImpl::setIdAttribute(const XMLCh* name) { if (fNode.isReadOnly()) throw DOMException( DOMException::NO_MODIFICATION_ALLOWED_ERR, 0); DOMAttr *attr = getAttributeNode(name); if (!attr) throw DOMException(DOMException::NOT_FOUND_ERR, 0); ((DOMAttrImpl *)attr)->addAttrToIDNodeMap(); }
frenzy::dom::Attrp frenzy::dom::Element::getAttributeNodeByIndex(size_t index) { if (index >= attributes.size()) return Attrp(); attributes_t::const_iterator iter = attributes.begin(); for (size_t i = 0; i < index; ++i, ++iter) { } return getAttributeNode(iter->first); }
void DOMElementImpl::setAttribute(const XMLCh *nam, const XMLCh *val) { if (fNode.isReadOnly()) throw DOMException( DOMException::NO_MODIFICATION_ALLOWED_ERR, 0); DOMAttr* newAttr = getAttributeNode(nam); if (!newAttr) { newAttr = this->fNode.getOwnerDocument()->createAttribute(nam); fAttributes->setNamedItem(newAttr); } newAttr->setNodeValue(val); }
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(); } }
void DOMElementImpl::setIdAttribute(const XMLCh* name, bool isId) { if (fNode.isReadOnly()) throw DOMException( DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); DOMAttr *attr = getAttributeNode(name); if (!attr) throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); if(isId) ((DOMAttrImpl *)attr)->addAttrToIDNodeMap(); else ((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap(); }
void DOMElementImpl::setIdAttributeNode(const DOMAttr *idAttr) { if (fNode.isReadOnly()) throw DOMException( DOMException::NO_MODIFICATION_ALLOWED_ERR, 0); DOMAttr *attr; const XMLCh* localName = idAttr->getLocalName(); if (localName) attr = getAttributeNodeNS(idAttr->getNamespaceURI(), idAttr->getLocalName()); else attr = getAttributeNode(idAttr->getName()); if(!attr) throw DOMException(DOMException::NOT_FOUND_ERR, 0); ((DOMAttrImpl *)attr)->addAttrToIDNodeMap(); }
bool DOMElementImpl::hasAttribute(const XMLCh *name) const { return (getAttributeNode(name) != 0); }
bool Element::hasAttribute(const XMLString& name) const { return getAttributeNode(name) != 0; }
void Element::removeAttribute(const XMLString& name) { Attr* pAttr = getAttributeNode(name); if (pAttr) removeAttributeNode(pAttr); }
bool Element::hasAttribute(DOMString* name) { return (getAttributeNode(name) != NULL); }