本文整理汇总了C++中Attr::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Attr::setValue方法的具体用法?C++ Attr::setValue怎么用?C++ Attr::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attr
的用法示例。
在下文中一共展示了Attr::setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAttribute
void Element::setAttribute(const XMLString& name, const XMLString& value)
{
Attr* pAttr = getAttributeNode(name);
if (pAttr)
{
pAttr->setValue(value);
}
else
{
pAttr = ownerDocument()->createAttribute(name);
pAttr->setValue(value);
setAttributeNode(pAttr);
pAttr->release();
}
}
示例2: setAttributeNS
void Element::setAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName, const XMLString& value)
{
Attr* pAttr = getAttributeNodeNS(namespaceURI, qualifiedName);
if (pAttr)
{
pAttr->setValue(value);
}
else
{
pAttr = _pOwner->createAttributeNS(namespaceURI, qualifiedName);
pAttr->setValue(value);
setAttributeNodeNS(pAttr);
pAttr->release();
}
}
示例3: runTest
/*
* Runs the test case.
*/
void runTest()
{
Document doc;
NodeList elementList;
Element firstNode;
Node testNode;
NamedNodeMap attributes;
Attr domesticAttr;
Attr setAttr;
Node setNode;
doc = (Document) baseT::load("staff", true);
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
firstNode = (Element) elementList.item(0);
domesticAttr = doc.createAttribute(SA::construct_from_utf8("domestic"));
domesticAttr.setValue(SA::construct_from_utf8("Yes"));
setAttr = firstNode.setAttributeNode(domesticAttr);
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
testNode = elementList.item(2);
attributes = testNode.getAttributes();
{
boolean success = false;
try {
setNode = attributes.setNamedItem(domesticAttr);
} catch (const DOMException& ex) {
success = (ex.code() == DOMException::INUSE_ATTRIBUTE_ERR);
}
assertTrue(success);
}
}
示例4: Attr
Node *
Attr::cloneNode(bool deep) const
{
Attr * attr = new Attr(*this);
if (deep) {
attr->setValue(getValue());
}
return attr;
}
示例5: runTest
/*
* Runs the test case.
*/
void runTest()
{
Document doc;
NodeList genderList;
Node gender;
NodeList genList;
Node gen;
NodeList gList;
Node g;
NamedNodeMap attrList;
Attr attrNode;
doc = (Document) baseT::load("staff", true);
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
gender = genderList.item(2);
baseT::assertNotNull(gender, __LINE__, __FILE__);
genList = gender.getChildNodes();
gen = genList.item(0);
baseT::assertNotNull(gen, __LINE__, __FILE__);
gList = gen.getChildNodes();
g = gList.item(0);
baseT::template skipIfNot<EntityReference>(g);
baseT::assertNotNull(g, __LINE__, __FILE__);
attrList = g.getAttributes();
baseT::assertNotNull(attrList, __LINE__, __FILE__);
attrNode = (Attr) attrList.getNamedItem(SA::construct_from_utf8("domestic"));
baseT::assertNotNull(attrNode, __LINE__, __FILE__);
{
boolean success = false;
try {
attrNode.setValue(SA::construct_from_utf8("newvalue"));
} catch (const DOMException& ex) {
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
}
assertTrue(success);
}
{
boolean success = false;
try {
attrNode.setNodeValue(SA::construct_from_utf8("newvalue2"));
} catch (const DOMException& ex) {
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
}
assertTrue(success);
}
}
示例6: setValue
void JSAttr::setValue(ExecState* exec, JSValue value)
{
Attr* imp = static_cast<Attr*>(impl());
String attrValue = valueToStringWithNullCheck(exec, value);
Element* ownerElement = imp->ownerElement();
if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag))) {
if (equalIgnoringCase(imp->name(), "src") && protocolIsJavaScript(deprecatedParseURL(attrValue))) {
if (!checkNodeSecurity(exec, static_cast<HTMLFrameElementBase*>(ownerElement)->contentDocument()))
return;
}
}
ExceptionCode ec = 0;
imp->setValue(attrValue, ec);
setDOMException(exec, ec);
}