コード例 #1
0
ファイル: Attr.cpp プロジェクト: CaptEmulation/svgl
bool
Attr::setId()
{
  Element * e = getOwnerElement();
  if (e == null)
    return false;
  if (e->isId(this)) {
    isId(true);
    return true;
  }
  return false;
}
コード例 #2
0
ファイル: DOMAttrNSImpl.cpp プロジェクト: ksmyth/xerces-c
DOMNode* DOMAttrNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
{
    DOMElement* el = getOwnerElement();
    if (el)
        el->removeAttributeNode(this);

    setName(namespaceURI, name);

    if (el)
        el->setAttributeNodeNS(this);

    return this;
}
コード例 #3
0
ファイル: DOMAttrImpl.cpp プロジェクト: AmesianX/Sigil
DOMNode* DOMAttrImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
{
    DOMElement* el = getOwnerElement();
    DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;

    if (el)
        el->removeAttributeNode(this);

    if (!namespaceURI || !*namespaceURI) {
        fName = doc->getPooledString(name);

        if (el)
            el->setAttributeNode(this);

        // and fire user data NODE_RENAMED event
        castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);

        return this;
    }
    else {

        // create a new AttrNS
        DOMAttr* newAttr = doc->createAttributeNS(namespaceURI, name);

        // transfer the userData
        doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newAttr));

        // move children to new node
        DOMNode* child = getFirstChild();
        while (child) {
            removeChild(child);
            newAttr->appendChild(child);
            child = getFirstChild();
        }

        // reattach attr to element
        if (el)
            el->setAttributeNodeNS(newAttr);

        // and fire user data NODE_RENAMED event
        castToNodeImpl(newAttr)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newAttr);

        return newAttr;
    }
}
コード例 #4
0
ファイル: Attr.cpp プロジェクト: CaptEmulation/svgl
void
Attr::addIdRef() const
{
  if (isId())
    getOwnerDocument()->putIdentifier(getNodeValue(), getOwnerElement());
}