本文整理汇总了C++中DOMElement::removeAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::removeAttribute方法的具体用法?C++ DOMElement::removeAttribute怎么用?C++ DOMElement::removeAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::removeAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteConfigAttribute
void Triggerconf::deleteConfigAttribute (string module, string submodule, string configname, string attributename)
{
if (! existsConfigElement (module, submodule, configname)) return;
DOMNode* currentConfigElement = selectConfigElement (module, submodule, configname);
if (currentConfigElement == NULL) return;
assert (currentConfigElement->getNodeType () == DOMNode::ELEMENT_NODE);
DOMElement* elem = (DOMElement*) currentConfigElement;
XMLCh* xattrname = XMLString::transcode (attributename.c_str ());
elem->removeAttribute (xattrname);
XMLString::release (&xattrname);
resetError ();
}
示例2: main
int main(int /*argc*/, char ** /*argv*/) {
Normalizer *normalizer = new Normalizer();
DOMDocument *doc = normalizer->createDocument();
bool *tmpTrue = new bool(true);
bool *tmpFalse = new bool(false);
DOMElement* docFirstElement = doc->createElementNS(X("http://www.test.com"),X("docEle"));
doc->appendChild(docFirstElement);
DOMElement* docFirstElementChild = doc->createElementNS(X("http://www.test2.com"),X("docEleChild"));
docFirstElement->appendChild(docFirstElementChild);
//create default ns
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//add in binding
docFirstElement->setPrefix(X("po"));
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//use default
DOMElement* docFirstElementChildChild = doc->createElementNS(X("http://www.test2.com"),X("docEleChildChild"));
docFirstElementChild->appendChild(docFirstElementChildChild);
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
// this block is needed to destroy the XMLBuffer
{
//use a binding
XMLBuffer buf;
buf.set(XMLUni::fgXMLNSString);
buf.append(chColon);
buf.append(X("po2"));
docFirstElementChild->removeAttributeNS(XMLUni::fgXMLNSURIName, XMLUni::fgXMLNSString);
docFirstElement->removeAttributeNS(XMLUni::fgXMLNSURIName, XMLUni::fgXMLNSString);
docFirstElement->setAttributeNS(XMLUni::fgXMLNSURIName, buf.getRawBuffer(), X("http://www.test2.com"));
docFirstElementChild->setPrefix(X("po2"));
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
}
//some siblngs to ensure the scope stacks are working
docFirstElementChildChild = doc->createElementNS(X("http://www.test3.com"),X("docEleChildChild2"));
docFirstElementChild->appendChild(docFirstElementChildChild);
docFirstElementChildChild = doc->createElementNS(X("http://www.test4.com"),X("po4:docEleChildChild3"));
docFirstElementChild->appendChild(docFirstElementChildChild);
docFirstElementChildChild = doc->createElementNS(X("http://www.test4.com"),X("po4:docEleChildChild4"));
docFirstElementChild->appendChild(docFirstElementChildChild);
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//conflicting prefix
docFirstElementChildChild->setAttributeNS(XMLUni::fgXMLNSURIName, X("po4"), X("conflict"));
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//conflicting default
docFirstElementChildChild = doc->createElementNS(X("http://www.test4.com"),X("docEleChildChild5"));
docFirstElementChild->appendChild(docFirstElementChildChild);
docFirstElementChildChild->setAttributeNS(XMLUni::fgXMLNSURIName, XMLUni::fgXMLNSString, X("conflict"));
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//set the xmlns to ""
DOMElement *noNamespaceEle = doc->createElementNS(X(""),X("noNamespace"));
docFirstElementChildChild->appendChild(noNamespaceEle);
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//now lets do a bit off attribute testing on the doc ele
docFirstElement->setAttributeNS(X("http://testattr.com"), X("attr1"), X("value"));
docFirstElement->setAttributeNS(X("http://testattr.com"), X("attr2"), X("value"));
docFirstElement->setAttributeNS(X("http://testattr2.com"), X("attr3"), X("value"));
docFirstElement->setAttributeNS(X("http://www.test.com"), X("attr4"), X("value"));
docFirstElement->setAttributeNS(X("http://testattr2.com"), X("po:attr5"), X("value"));
docFirstElement->setAttributeNS(X("http://testattr2.com"), X("poFake:attr6"), X("value"));
docFirstElement->setAttributeNS(X("http://testattr3.com"), X("po3:attr7"), X("value"));
doc->normalizeDocument();
normalizer->serializeNode(doc);
XERCES_STD_QUALIFIER cout << "\n\n";
//and now on one of its children
docFirstElementChildChild->setAttributeNS(X("http://testattr.com"), X("attr1"), X("value"));
docFirstElementChildChild->setAttributeNS(X("http://testattr.com"), X("attr2"), X("value"));
docFirstElementChildChild->setAttributeNS(X("http://testattr2.com"), X("attr3"), X("value"));
docFirstElementChildChild->setAttributeNS(X("http://www.test.com"), X("attr4"), X("value"));
docFirstElementChildChild->setAttributeNS(X("http://testattr2.com"), X("po:attr5"), X("value"));
docFirstElementChildChild->setAttributeNS(X("http://testattr2.com"), X("poFake:attr6"), X("value"));
docFirstElementChildChild->setAttributeNS(X("http://testattr3.com"), X("po3:attr7"), X("value"));
//.........这里部分代码省略.........