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


C++ DOMElement::getAttributeNode方法代码示例

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


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

示例1:

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

示例2: 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

示例3: existsConfigAttribute

bool Triggerconf::existsConfigAttribute (string module, string submodule, string configname, string attributename)
{
	bool autoval	= autocreate;
	autocreate	= false;
	
	DOMNode* currentConfigElement = selectConfigElement (module, submodule, configname);
	autocreate = autoval;
	if (currentConfigElement == NULL) return false;

	assert (currentConfigElement->getNodeType () == DOMNode::ELEMENT_NODE);
	DOMElement* elem = (DOMElement*) currentConfigElement;

	XMLCh* xattrname	= XMLString::transcode (attributename.c_str ());
	bool hasattr		= elem->getAttributeNode (xattrname) != NULL;
	XMLString::release	(&xattrname);

	return hasattr;
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:18,代码来源:triggerconf.cpp

示例4: ps

/**
 * 2DO extend to support non default references
 * If no tuning present, will default to 12ET
 */
Tuning *PMLDocument::getTuning(){

    DOMElement *perf = getSingleElement(m_doc->getDocumentElement(), "performance");

    if( !perf ){
//cerr << "No performance element! Defaulting to 12ET\n";
    }
    else{

        DOMElement *tuningEl = getSingleElement(perf, "tuning");


        if( !tuningEl ){
            cout << "No tuning element! Defaulting to 12ET\n";
        }
        else{
            string tuningName = XS( tuningEl->getAttribute(XS("name")) );

            IntervalList *intervals = new IntervalList;
            SpellingList *spellingList = new SpellingList;

            /* Get intervals */
            DOMElement* intList = getSingleElement(tuningEl,"intervallist");

            DOMNodeList *intervalEls = intList->getElementsByTagName(XS("interval"));
            for( int i=0; i<intervalEls->getLength(); i++ ){
                string is = getText((DOMElement*)intervalEls->item(i));
	//cout << "Interval " << is << endl;
                intervals->push_back( atof(is.c_str())  );
            }

            /* Get enharmonic equivalent spellings */
            DOMElement *spellingListEl = getSingleElement( tuningEl, "spellinglist" );
            DOMNodeList *equivs = spellingListEl->getElementsByTagName(XS("enharmequiv"));

            for( int e=0; e<equivs->getLength(); e++ ){

                DOMElement *equiv = (DOMElement*)equivs->item(e);
                DOMNodeList *spellings = equiv->getElementsByTagName(XS("spelling"));

                for( int i=0; i<spellings->getLength(); i++ ){

                    DOMElement* spEl = (DOMElement*)spellings->item(i);

                    Accidental acc;
                    if( spEl->getAttributeNode(XS("acc")) == NULL )  
                        acc = Accidentals::NoAccidental;
                    else
                        acc = XS( spEl->getAttribute(XS("acc")) );
	//cout << "Acc " << acc << endl;
	
                    string notest = XS(spEl->getAttribute(XS("note")));
                    char note = notest[0];
	
                    PitchSpelling ps(note,acc);
                    SpellingListItem spi( e, ps );
                    spellingList->insert( spi);
                }
            }

            Tuning *tuning = new Tuning( tuningName, intervals, spellingList);
            return tuning;
        }      
    }



    std::vector<Tuning*>* tunings = Tuning::getTunings( "/usr/local/lib/tunings" );
    Tuning *tuning = tunings->at(0);
    return tuning;
}
开发者ID:jmacritchie,项目名称:DougMatcher,代码行数:75,代码来源:pmldocument.cpp


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