Exemplo n.º 1
0
Arquivo: Element.cpp Projeto: 119/vdc
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;
}
Exemplo n.º 2
0
Arquivo: Element.cpp Projeto: 119/vdc
const XMLString& Element::getAttribute(const XMLString& name) const
{
	Attr* pAttr = getAttributeNode(name);
	if (pAttr)
		return pAttr->getValue();
	else
		return EMPTY_STRING;
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
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();
}
Exemplo n.º 5
0
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);
}
Exemplo n.º 6
0
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);
}
Exemplo n.º 7
0
Arquivo: Element.cpp Projeto: 119/vdc
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();
	}
}
Exemplo n.º 8
0
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();
}
Exemplo n.º 9
0
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();
}
Exemplo n.º 10
0
bool DOMElementImpl::hasAttribute(const XMLCh *name) const
{
    return (getAttributeNode(name) != 0);
}
Exemplo n.º 11
0
Arquivo: Element.cpp Projeto: 119/vdc
bool Element::hasAttribute(const XMLString& name) const
{
	return getAttributeNode(name) != 0;
}
Exemplo n.º 12
0
Arquivo: Element.cpp Projeto: 119/vdc
void Element::removeAttribute(const XMLString& name)
{
	Attr* pAttr = getAttributeNode(name);
	if (pAttr) removeAttributeNode(pAttr);
}
Exemplo n.º 13
0
 bool Element::hasAttribute(DOMString* name)
 {
   return (getAttributeNode(name) != NULL);
 }