本文整理汇总了C++中Attr::value方法的典型用法代码示例。如果您正苦于以下问题:C++ Attr::value方法的具体用法?C++ Attr::value怎么用?C++ Attr::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attr
的用法示例。
在下文中一共展示了Attr::value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Node*
Element::_getElementById (const DOMString& id)
{
for (size_t i = 0; i < _children.length(); i++) {
NamedNodeMap attrs = _children.item(i)->attributes();
for (size_t h = 0; h < attrs.length(); h++) {
Attr* attr = (Attr*) attrs.item(h);
if (attr->_isId) {
if (attr->value() == id) {
return _children.item(i);
}
}
}
}
for (size_t i = 0; i < _children.length(); i++) {
Node* element = _children.item(i)->_getElementById(id);
if (element) {
return element;
}
}
return NULL;
}
示例2: throw
void
Element::setAttribute (const DOMString& name, const DOMString& value) throw()
{
Attr* attr = (Attr*) _attributes.getNamedItem(name);
if (attr == NULL) {
attr = new Attr(this->ownerDocument(), name);
this->setAttributeNode(attr);
}
attr->value(value);
attr->_ownerElement = this;
}
示例3: setAttributeNode
JSValue JSElement::setAttributeNode(ExecState* exec, const ArgList& args)
{
ExceptionCode ec = 0;
Attr* newAttr = toAttr(args.at(0));
if (!newAttr) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
}
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
return jsUndefined();
JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
setDOMException(exec, ec);
return result;
}
示例4: Element
Node*
Element::cloneNode (bool deep)
{
Element* element = new Element(NULL, this->nodeName());
for (unsigned long i = 0; i < _attributes.length(); i++) {
Attr* attr = (Attr*) _attributes.item(i);
element->setAttribute(attr->name(), attr->value());
}
if (deep) {
for (unsigned long i = 0; i < _children.length(); i++) {
element->appendChild(_children.item(i)->cloneNode(true));
}
}
return element;
}
示例5: handleElement
void DOMSerializer::handleElement(const Element* pElement) const
{
if (_pContentHandler)
{
AutoPtr<NamedNodeMap> pAttrs = pElement->attributes();
AttributesImpl saxAttrs;
for (unsigned long i = 0; i < pAttrs->length(); ++i)
{
Attr* pAttr = static_cast<Attr*>(pAttrs->item(i));
saxAttrs.addAttribute(pAttr->namespaceURI(), pAttr->localName(), pAttr->nodeName(), CDATA, pAttr->value(), pAttr->specified());
}
_pContentHandler->startElement(pElement->namespaceURI(), pElement->localName(), pElement->tagName(), saxAttrs);
}
iterate(pElement->firstChild());
if (_pContentHandler)
_pContentHandler->endElement(pElement->namespaceURI(), pElement->localName(), pElement->tagName());
}