本文整理汇总了C++中msxml2::IXMLDOMElementPtr::getAttributeNode方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMElementPtr::getAttributeNode方法的具体用法?C++ IXMLDOMElementPtr::getAttributeNode怎么用?C++ IXMLDOMElementPtr::getAttributeNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMElementPtr
的用法示例。
在下文中一共展示了IXMLDOMElementPtr::getAttributeNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FAILED
//.........这里部分代码省略.........
// Walk through children of document element
// and process according to type
spNodeTemp = spElemTemp->firstChild;
// TODO more checking needed for the config file
while (spNodeTemp != NULL)
{
// Process node depending on type
cNodeType = spNodeTemp->nodeType;
switch (cNodeType)
{
// Comment Node
case NODE_COMMENT:
if (Debug::Enabled(Debug::CONFIG))
std::cout<<"Comment Node:" << std::endl << " "<<_bstr_t(spNodeTemp->nodeValue)<<std::endl;
break;
// Element Node
case NODE_ELEMENT:
{
std::string tempString;
spElemTemp = (IXMLDOMElementPtr) spNodeTemp;
std::string node = (const char *)spElemTemp->nodeName;
Debug::PrintLine(Debug::CONFIG, "Processing %s", node.c_str());
// A note on processing attributes
// MSXML doesn't support the hasAttribute method,
// so we'll try to get the Attribute node, then its value.
// eg
// spAttrTemp = spElemTemp->getAttributeNode("Attribute1");
// if (spAttrTemp != NULL) // test if "get" was successful
// ...
if (node == "MSS") {
spAttrTemp = spElemTemp->getAttributeNode("PORT");
if (spAttrTemp != NULL) {
mMSSListenerPort = (u_short)strtol((char *)_bstr_t(spAttrTemp->nodeValue), NULL, 0);
Debug::PrintLine(Debug::CONFIG, " PORT Value: %d", mMSSListenerPort);
}
} else if (node == "DISK") {
spAttrTemp = spElemTemp->getAttributeNode("DRIVE");
if (spAttrTemp != NULL) {
mDrive = (char *)_bstr_t(spAttrTemp->nodeValue);
Debug::PrintLine(Debug::CONFIG, " DRIVE: %s", mDrive.c_str());
}
spAttrTemp = spElemTemp->getAttributeNode("ROOT");
if (spAttrTemp != NULL) {
mRoot = (char *)_bstr_t(spAttrTemp->nodeValue);
FixPath(mRoot); // replace all backslashes \ with forward slashes /
Debug::PrintLine(Debug::CONFIG, " ROOT: %s", mRoot.c_str());
}
} else if (node == "INFO") {
spAttrTemp = spElemTemp->getAttributeNode("DRIVE");
if (spAttrTemp != NULL) {
mInfoDrive = (char *)_bstr_t(spAttrTemp->nodeValue);
Debug::PrintLine(Debug::CONFIG, " INFO DRIVE: %s", mInfoDrive.c_str());
}
spAttrTemp = spElemTemp->getAttributeNode("ROOT");
if (spAttrTemp != NULL) {
mInfoRoot = (char *)_bstr_t(spAttrTemp->nodeValue);
FixPath(mInfoRoot); // replace all backslashes \ with forward slashes /
Debug::PrintLine(Debug::CONFIG, " INFO ROOT: %s", mInfoRoot.c_str());
}
spAttrTemp = spElemTemp->getAttributeNode("FILE");
if (spAttrTemp != NULL) {
mInfoFile = (char *)_bstr_t(spAttrTemp->nodeValue);
Debug::PrintLine(Debug::CONFIG, " INFO FILE: %s", mInfoFile.c_str());