当前位置: 首页>>代码示例>>C++>>正文


C++ DOMAttr类代码示例

本文整理汇总了C++中DOMAttr的典型用法代码示例。如果您正苦于以下问题:C++ DOMAttr类的具体用法?C++ DOMAttr怎么用?C++ DOMAttr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DOMAttr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

DOMAttr *DOMNodeIDMap::find(const XMLCh *id)
{
    //
    //  Get the hashcode for the supplied string.
    //
	XMLSize_t initalHash = XMLString::hash(id, fSize-1, ((DOMDocumentImpl *)fDoc)->getMemoryManager());
	initalHash++;
	XMLSize_t currentHash = initalHash;

	//
	// Loop looking for a slot pointing to an attr with this id.
    //
    while (true)
	{
		DOMAttr *tableSlot = fTable[currentHash];
		if (tableSlot == 0)
        {
            // There is no matching entry in the table
            return 0;
        }


        if ((tableSlot != (DOMAttr *)-1) && XMLString::equals(tableSlot->getValue(), id))
            return tableSlot;

        currentHash += initalHash;  // rehash
        if (currentHash >= fSize)
            currentHash = currentHash % fSize;
    }
    return 0;  // Never gets here, but keeps some compilers happy.
}
开发者ID:js422,项目名称:PERL,代码行数:31,代码来源:DOMNodeIDMap.cpp

示例2:

void SYSTEM::CConfigItem::SetProperties(const char * propName, const char * value)
{
	if(!propName||!value)
	{
		return;
	}
	if(((DOMElement*)itemElement)->hasAttributes())
	{
		DOMNamedNodeMap *pAttributes = ((DOMElement*)itemElement)->getAttributes();
		XMLCh *t = XMLString::transcode(propName);
		DOMAttr *pAttributeNode = (DOMAttr*)pAttributes->getNamedItem(t);
		XMLString::release(&t);
		if(!pAttributeNode)
		{
			return;	//属性名错误,抛出异常
		}
		t = XMLString::transcode(value);
		pAttributeNode->setValue(t);
		XMLString::release(&t);
	}
	else
	{
		return;
	}	 
}
开发者ID:lozpeng,项目名称:applesales,代码行数:25,代码来源:ConfigItem.cpp

示例3: getAttributeByName

std::string getAttributeByName (DOMNode* node, std::string attrName) {
	cdebug << "getAttr " << attrName << std::endl;
	assert (node->getNodeType () == DOMNode::ELEMENT_NODE);
	
	std::string value = "";
	
	if (node->hasAttributes()) {
		DOMNamedNodeMap *pAttributes = node->getAttributes ();
		
		for (unsigned int i = 0; i < pAttributes->getLength (); i++) {
			DOMAttr* pAttributeNode = (DOMAttr*) pAttributes->item(i);
			char* name = XMLString::transcode(pAttributeNode->getName());
			if (name == attrName) {
				char* tmpValue = XMLString::transcode(pAttributeNode->getValue());
				value = tmpValue;
				XMLString::release(&tmpValue);
			}
			XMLString::release(&name);
		}
	} else {
		cdebug << "Error in file to parse" << std::endl;
		throw ("Error in file to parse attributes");
	}
	cdebug << value << std::endl;
	return value;
} /* std::string getAttributeByName (DOMNode* node, std::string attrName) */
开发者ID:BackupTheBerlios,项目名称:moneybook-svn,代码行数:26,代码来源:libmoneybook.cpp

示例4: toXML

DOMElement* EppCommandInfoLaunchRegistration::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = EppUtil::createElementNS(doc, "launch", (tag.isNull()) ? "info" : tag, false, "-1.0");

	DOMAttr* attr = doc.createAttribute(XS("includeMark"));
	attr->setValue( ( this->_includeMark ) ? XS("true") : XS("false") );
	body->setAttributeNode(attr);

	if( this->_phase.phase().length() > 0 )
	{
		DOMElement* elm = this->_phase.toXML(doc, "phase");
		body->appendChild(elm);
	}
	if( this->_appId.isNotNull() )
	{
		if( this->_appId.length() > 0 )
		{
			elm = doc.createElement(XS("applicationID"));
			elm->appendChild(doc.createTextNode(this->_appId));
			body->appendChild(elm);
		}
	}
	return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:25,代码来源:EppCommandInfoLaunchRegistration.cpp

示例5: DOMException

DOMNode *DOMAttrMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName)
{
    if (this->readOnly())
        throw DOMException(
        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
    int i = findNamePoint(namespaceURI, localName);
    if (i < 0)
        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);

    DOMNode * removed = fNodes -> elementAt(i);
    fNodes -> removeElementAt(i);	//remove n from nodes
    castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
    castToNodeImpl(removed)->isOwned(false);

    // Replace it if it had a default value
    // (DOM spec level 2 - Element Interface)

    if (hasDefaults() && (removed != 0))
    {
        DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
        DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItemNS(namespaceURI, localName));
        if (attr != 0)
        {
            DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
            setNamedItemNS(newAttr);
        }
    }

    return removed;
}
开发者ID:js422,项目名称:PERL,代码行数:30,代码来源:DOMAttrMapImpl.cpp

示例6: while

DOMAttr *DOMNodeIDMap::find(const XMLCh *id)
{
    //
    //  Get the hashcode for the supplied string.
    //
    XMLSize_t initalHash = XMLString::hash(id, fSize-1);
	initalHash++;
	XMLSize_t currentHash = initalHash;

	//
	// Loop looking for a slot pointing to an attr with this id.
    //
	DOMAttr *tableSlot;
    while ((tableSlot= fTable[currentHash])!=0)
	{
        if ((tableSlot != (DOMAttr *)-1) && XMLString::equals(tableSlot->getValue(), id))
            return tableSlot;

        currentHash += initalHash;  // rehash
        if (currentHash >= fSize)
            currentHash = currentHash % fSize;
    }
    // There is no matching entry in the table
    return 0;
}
开发者ID:JohnWilliam1988,项目名称:TCIDE,代码行数:25,代码来源:DOMNodeIDMap.cpp

示例7: getLength

/**
 * Get this AttributeMap in sync with the given "defaults" map.
 * @param defaults The default attributes map to sync with.
 */
void DOMAttrMapImpl::reconcileDefaultAttributes(const DOMAttrMapImpl* defaults) {

    // remove any existing default
    XMLSize_t nsize = getLength();
    for (XMLSSize_t i = nsize - 1; i >= 0; i--) {
        DOMAttr* attr = (DOMAttr*)item(i);
        if (!attr->getSpecified()) {
            removeNamedItemAt(i);
        }
    }

    hasDefaults(false);

    // add the new defaults
    if (defaults) {
        hasDefaults(true);

        if (nsize == 0) {
            cloneContent(defaults);
        }
        else {
            XMLSize_t dsize = defaults->getLength();
            for (XMLSize_t n = 0; n < dsize; n++) {
                DOMAttr* attr = (DOMAttr*)defaults->item(n);

                DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
                setNamedItemNS(newAttr);
                DOMAttrImpl* newAttrImpl = (DOMAttrImpl*) newAttr;
                newAttrImpl->setSpecified(false);
            }
        }
    }
} // reconcileDefaults()
开发者ID:js422,项目名称:PERL,代码行数:37,代码来源:DOMAttrMapImpl.cpp

示例8: completeDeletions

void XercesUpdateFactory::completeDeletions(DynamicContext *context)
{
  //    e. Finally, for each node marked for deletion by one of the update primitives listed above, let $N be the node that is marked
  //       for deletion, and let $P be its parent node. The following actions are applied:
  //          i. The parent property of $N is set to empty.
  //         ii. If $N is an attribute node, the attributes property of $P is modified to remove $N.
  //        iii. If $N is a non-attribute node, the children property of $P is modified to remove $N.
  //         iv. If $N is an element, attribute, or text node, and $P is an element node, then upd:removeType($P) is invoked.

  for(DOMNodeSet::iterator i = forDeletion_.begin(); i != forDeletion_.end(); ++i) {
    DOMNode *domnode = *i;

    if(domnode->getNodeType() == DOMNode::ATTRIBUTE_NODE) {
      DOMAttr *attr = (DOMAttr*)domnode;
      DOMElement *owner = attr->getOwnerElement();
      if(owner != 0) {
        owner->removeAttributeNode(attr);
        removeType(owner);
      }
    }
    else {
      DOMNode *parent = domnode->getParentNode();
      if(parent != 0) {
        parent->removeChild(domnode);
        if(domnode->getNodeType() == DOMNode::ELEMENT_NODE ||
           domnode->getNodeType() == DOMNode::TEXT_NODE ||
           domnode->getNodeType() == DOMNode::CDATA_SECTION_NODE) {
          removeType(parent);
        }
      }
    }
  }
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:33,代码来源:XercesUpdateFactory.cpp

示例9: attributeEvent

  virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
                              const XMLCh *typeURI, const XMLCh *typeName)
  {
    assert(node_ && node_->getNodeType() == DOMNode::ELEMENT_NODE);

    DOMNamedNodeMap *attrs = node_->getAttributes();
    DOMAttr *at = (DOMAttr*)attrs->getNamedItemNS(uri, localname);

    // Add the attribute
    if(!at) {
      at = node_->getOwnerDocument()->createAttributeNS(uri, localname);
      if(prefix && *prefix)
        at->setPrefix(prefix);
      attrs->setNamedItemNS(at);
    }

    // Copy the schema normalized value
    at->setNodeValue(value);

    // Copy the attribute's type
    const XMLCh *oldTypeURI, *oldTypeName;
    XercesNodeImpl::typeUriAndName(at, oldTypeURI, oldTypeName);
    if(!XPath2Utils::equals(oldTypeName, typeName) ||
       !XPath2Utils::equals(oldTypeURI, typeURI)) {
      XercesSequenceBuilder::setAttributeTypeInfo(at, typeURI, typeName);
    }
  }
开发者ID:xubingyue,项目名称:xqilla,代码行数:27,代码来源:XercesUpdateFactory.cpp

示例10: toXMLPoll

DOMElement* EppCommandTransferDomain::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* body = toXMLPoll(doc, tag);

	DOMAttr* attr = doc.createAttribute(XS("op"));
	attr->setValue(this->getOperation());
	ValueVectorOf<DOMAttr*> attrList(1);
	attrList.addElement(attr);

	return toXMLCommon(doc, tag, body, &attrList);
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:11,代码来源:EppCommandTransferDomain.cpp

示例11: CopyAttr

bool CopyAttr(DOMElement *target, const DOMElement *source, const XMLCh* attrName, bool MustBeFound=true) {
	DOMAttr *attrNode = source->getAttributeNode(attrName);
	if (attrNode==NULL) {
		if (MustBeFound==true) {
			THROW_AWAY(("Mandatory Attribute on Delta Operation Node was not found for CopyAttr()"));
		}
		else return false;
	}
	target->setAttribute(attrName, attrNode->getNodeValue());
	return true;
}
开发者ID:alon,项目名称:xydiff,代码行数:11,代码来源:DeltaReverse.cpp

示例12:

const char *SkinElementsMgr::getElementAlias(const char *id)  {
  if(m_doc) {   
    DOMElement * node = m_doc->getElementById(id);
    if (node && !STRCMP(node->getNodeName(),"elementalias")) {
      DOMAttr * attr = node->getAttributeNode("target");
      if( attr && attr->getSpecified() )
        return attr->getValue();
    }
  }
  return NULL;
}
开发者ID:bizzehdee,项目名称:wasabi,代码行数:11,代码来源:skinelem.cpp

示例13: attribute

	bool Manager::attribute(const DOMNode* n,const u_str attrname) {
		bool result=false;
		if (n != nullptr && !attrname.empty() && n->getNodeType() == DOMNode::ELEMENT_NODE ) {
			DOMElement* enod = (DOMElement*)n;
			DOMAttr* enoda = enod->getAttributeNode(pcx(attrname.c_str()));
			if (enoda != nullptr) {
				const XMLCh* x_attrval = enoda->getNodeValue();
				if (x_attrval != nullptr && x_attrval[0] != 0 ) {
					result = true; //only true if result is not empty.
				}
			}
		}
		return result;
	}
开发者ID:RedSnapper,项目名称:Obyx,代码行数:14,代码来源:manager.cpp

示例14: toXML

DOMElement* EppCommandCreateLaunchRegistration::toXML( DOMDocument& doc, const DOMString& tag )
{
    DOMElement* elm;
    DOMElement* body = EppUtil::createElementNS(doc, "launch", (tag.isNull()) ? "create" : tag, false, "-1.0");

    if( this->_type.length() > 0 )
    {
        DOMAttr* attr = doc.createAttribute(XS("type"));
        attr->setValue( this->_type);
        body->setAttributeNode(attr);
    }

    if ( this->_phase.phase().length() > 0 )
    {
        DOMElement* elm = this->_phase.toXML(doc, "phase");
        body->appendChild(elm);
    }

    if( (_signedMark.hasSMD()) )
    {   /*RAII*/
        DOMElement* elm = this->_signedMark.toXML(doc, "signedMark");
        body->appendChild(elm);
    }
    if( (_encSignedMark.hasSMD()) )
    {   /*RAII*/
        DOMElement* elm = this->_encSignedMark.toXML(doc, "encodedSignedMark");
        body->appendChild(elm);
    }
    if( this->_noticeID.length() > 0  )
    {
        elm = doc.createElement(XS("noticeID"));
        elm->appendChild(doc.createTextNode(this->_noticeID));
        body->appendChild(elm);
    }
    if( this->_notAfter.length() > 0  )
    {
        elm = doc.createElement(XS("notAfter"));
        elm->appendChild(doc.createTextNode(this->_notAfter));
        body->appendChild(elm);
    }
    if( this->_acceptedDate.length() > 0  )
    {
        elm = doc.createElement(XS("acceptedDate"));
        elm->appendChild(doc.createTextNode(this->_acceptedDate));
        body->appendChild(elm);
    }

    return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:49,代码来源:EppCommandCreateLaunchRegistration.cpp

示例15: moveSpecifiedAttributes

/**
 * Move specified attributes from the given map to this one
 */
void DOMAttrMapImpl::moveSpecifiedAttributes(DOMAttrMapImpl* srcmap) {
    XMLSize_t nsize = srcmap->getLength();

    for (XMLSSize_t i = nsize - 1; i >= 0; i--) {
        DOMAttr* attr = (DOMAttr*)srcmap->item(i);
        if (attr->getSpecified()) {
            srcmap->removeNamedItemAt(i);
        }

        if (attr->getLocalName())
            setNamedItemNS(attr);
        else
            setNamedItem(attr);
    }
} // moveSpecifiedAttributes(AttributeMap):void
开发者ID:js422,项目名称:PERL,代码行数:18,代码来源:DOMAttrMapImpl.cpp


注:本文中的DOMAttr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。