本文整理汇总了C++中NamedNodeMap::release方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedNodeMap::release方法的具体用法?C++ NamedNodeMap::release怎么用?C++ NamedNodeMap::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedNodeMap
的用法示例。
在下文中一共展示了NamedNodeMap::release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseXML
/**
* Parse incomming message (from server).
* @param str Incomming server message
* @return Message in Command structure
*/
Command XMLTool::parseXML(string str) {
Command cmd;
try {
DOMParser parser = DOMParser(0);
AutoPtr<Document> pDoc = parser.parseString(str);
NodeIterator it(pDoc, NodeFilter::SHOW_ELEMENT);
Node* pNode = it.nextNode();
NamedNodeMap* attributes = NULL;
Node* attribute = NULL;
while (pNode) {
if (pNode->nodeName().compare("server_adapter") == 0) {
if (pNode->hasAttributes()) {
attributes = pNode->attributes();
for(unsigned int i = 0; i < attributes->length(); i++) {
attribute = attributes->item(i);
if (attribute->nodeName().compare("protocol_version") == 0) {
cmd.protocol_version = attribute->nodeValue();
}
else if (attribute->nodeName().compare("state") == 0) {
cmd.state = attribute->nodeValue();
}
// FIXME - id attribute is here only for backward compatibility, it should be removed in Q1/2016
else if (attribute->nodeName().compare("euid") == 0 || attribute->nodeName().compare("id") == 0) {
cmd.euid = stoull(attribute->nodeValue(), nullptr, 0);
}
else if (attribute->nodeName().compare("device_id") == 0) {
cmd.device_id = atoll(attribute->nodeValue().c_str());
}
else if (attribute->nodeName().compare("time") == 0) {
cmd.time = atoll(attribute->nodeValue().c_str());
}
else {
log.error("Unknow attribute for SERVER_ADAPTER : " + fromXMLString(attribute->nodeName()));
}
}
attributes->release();
}
}
else if (pNode->nodeName().compare("value") == 0) {
if(cmd.state == "getparameters" || cmd.state == "parameters"){
string inner = pNode->innerText();
string device_id = "";
if (pNode->hasAttributes()) {
attributes = pNode->attributes();
string device_id = "";
for(unsigned int i = 0; i < attributes->length(); i++) {
attribute = attributes->item(i);
if (attribute->nodeName().compare("device_id") == 0) {
device_id = toNumFromString(attribute->nodeValue());
}
}
attributes->release();
}
cmd.params.value.push_back({inner, device_id});
}
else {
float val = atof(pNode->innerText().c_str());
if (pNode->hasAttributes()) {
int module_id = 0;
attributes = pNode->attributes();
for(unsigned int i = 0; i < attributes->length(); i++) {
attribute = attributes->item(i);
if (attribute->nodeName().compare("module_id") == 0) {
module_id = toNumFromString(attribute->nodeValue());
}
}
cmd.values.push_back({module_id, val}); //TODO Hex number is processed wrongly
attributes->release();
}
}
}
else if (pNode->nodeName().compare("parameter") == 0) {
if (pNode->hasAttributes()) {
attributes = pNode->attributes();
for(unsigned int i = 0; i < attributes->length(); i++) {
attribute = attributes->item(i);
if (attribute->nodeName().compare("param_id") == 0 || attribute->nodeName().compare("id") == 0) {
cmd.params.param_id = toNumFromString(attribute->nodeValue());
}
else if (attribute->nodeName().compare("euid") == 0) {
cmd.params.euid = toNumFromString(attribute->nodeValue());
}
}
attributes->release();
}
}
//.........这里部分代码省略.........