本文整理汇总了C++中NamedNodeMap::getAttributeItem方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedNodeMap::getAttributeItem方法的具体用法?C++ NamedNodeMap::getAttributeItem怎么用?C++ NamedNodeMap::getAttributeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedNodeMap
的用法示例。
在下文中一共展示了NamedNodeMap::getAttributeItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluate
Value FunLang::evaluate() const
{
String lang = arg(0)->evaluate().toString();
Attribute* languageAttribute = 0;
Node* node = evaluationContext().node.get();
while (node) {
NamedNodeMap* attrs = node->attributes();
if (attrs)
languageAttribute = attrs->getAttributeItem(XMLNames::langAttr);
if (languageAttribute)
break;
node = node->parentNode();
}
if (!languageAttribute)
return BOOL_TO_VALUE_CAST false;
String langValue = languageAttribute->value();
while (true) {
if (equalIgnoringCase(langValue, lang))
return BOOL_TO_VALUE_CAST true;
// Remove suffixes one by one.
size_t index = langValue.reverseFind('-');
if (index == notFound)
break;
langValue = langValue.left(index);
}
return BOOL_TO_VALUE_CAST false;
}
示例2: areIdenticalElements
bool areIdenticalElements(const Node* first, const Node* second)
{
// check that tag name and all attribute names and values are identical
if (!first->isElementNode() || !second->isElementNode())
return false;
if (!toElement(first)->tagQName().matches(toElement(second)->tagQName()))
return false;
NamedNodeMap* firstMap = toElement(first)->attributes();
NamedNodeMap* secondMap = toElement(second)->attributes();
unsigned firstLength = firstMap->length();
if (firstLength != secondMap->length())
return false;
for (unsigned i = 0; i < firstLength; i++) {
Attribute* attribute = firstMap->attributeItem(i);
Attribute* secondAttribute = secondMap->getAttributeItem(attribute->name());
if (!secondAttribute || attribute->value() != secondAttribute->value())
return false;
}
return true;
}
示例3: mergeAttributesFromTokenIntoElement
void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken& token, Element* element)
{
if (!token.attributes())
return;
NamedNodeMap* attributes = element->attributes(false);
for (unsigned i = 0; i < token.attributes()->length(); ++i) {
Attribute* attribute = token.attributes()->attributeItem(i);
if (!attributes->getAttributeItem(attribute->name()))
element->setAttribute(attribute->name(), attribute->value());
}
}