本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}