本文整理汇总了C++中DOMElement::removeAttributeNS方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::removeAttributeNS方法的具体用法?C++ DOMElement::removeAttributeNS怎么用?C++ DOMElement::removeAttributeNS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::removeAttributeNS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clearXPathNS
void clearXPathNS(DOMDocument *d,
XSECXPathNodeList &toRemove,
XSECSafeBufferFormatter *formatter,
XSECNameSpaceExpander * nse) {
// Clear the XPath name spaces in the document element attribute list
DOMElement * e = d->getDocumentElement();
if (e == NULL) {
throw XSECException(XSECException::XPathError, "Element node not found in Document");
}
// Run through each node in the added nodes
const DOMNode * r = toRemove.getFirstNode();
while (r != NULL) {
e->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
r->getLocalName());
r = toRemove.getNextNode();
}
e->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
MAKE_UNICODE_STRING(KLUDGE_PREFIX));
}
示例2: evaluateEnvelope
void TXFMXPath::evaluateEnvelope(DOMNode *t) {
// A special case where the XPath expression is already known
if (document == NULL) {
throw XSECException(XSECException::XPathError,
"Attempt to define XPath Name Space before setInput called");
}
DOMElement * e = document->getDocumentElement();
if (e == NULL) {
throw XSECException(XSECException::XPathError,
"Element node not found in Document");
}
// Set the xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
e->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, MAKE_UNICODE_STRING("xmlns:dsig"), DSIGConstants::s_unicodeStrURIDSIG);
// Evaluate
evaluateExpr(t, XPATH_EXPR_ENVELOPE);
// Now we are done, remove the namespace
e->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, MAKE_UNICODE_STRING("dsig"));
}
示例3: deleteNamespace
void DSIGTransformXPath::deleteNamespace(const char * prefix) {
DOMElement *x;
x = static_cast <DOMElement *> (mp_xpathNode);
// if (x == NULL) {
//
// throw XSECException(XSECException::TransformError,
// "Found a non ELEMENT node as the XPath node in DSIGTransformXPath");
// }
x->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
MAKE_UNICODE_STRING(prefix));
}
示例4: 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"));
//.........这里部分代码省略.........