本文整理汇总了C++中appsecinc::xml::XmlDocument::GetAttributeBoolValue方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlDocument::GetAttributeBoolValue方法的具体用法?C++ XmlDocument::GetAttributeBoolValue怎么用?C++ XmlDocument::GetAttributeBoolValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appsecinc::xml::XmlDocument
的用法示例。
在下文中一共展示了XmlDocument::GetAttributeBoolValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msiInstall
CA_API UINT __stdcall LocalGroupMembers_Deferred(MSIHANDLE hInstall)
{
MSI_EXCEPTION_HANDLER_PROLOG;
MsiInstall msiInstall(hInstall);
AppSecInc::Xml::XmlDocument xmlDocument;
xmlDocument.LoadXml(msiInstall.GetActionData());
MSXML2::IXMLDOMNodeListPtr rows = xmlDocument.SelectNodes(L"/LocalGroupMembers/LocalGroupMember");
MSXML2::IXMLDOMNodePtr row = NULL;
while (NULL != (row = rows->nextNode()))
{
std::wstring id = xmlDocument.GetAttributeValue(L"id", row);
std::wstring username = xmlDocument.GetNodeValue(L"Username", row);
std::wstring groupname = xmlDocument.GetNodeValue(L"Group", row, L"");
bool add_member = xmlDocument.GetAttributeBoolValue(L"add", row);
bool remove_member = xmlDocument.GetAttributeBoolValue(L"remove", row);
bool check = xmlDocument.GetAttributeBoolValue(L"check", row);
if (remove_member && (! check || AppSecInc::LSA::LocalGroup::IsMember(groupname, username)))
{
msiInstall.LogInfo(_T(__FUNCTION__), L"Removing \"" + username + L"\" from \"" + groupname + L"\"");
AppSecInc::LSA::LocalGroup::DeleteMember(groupname, username);
}
if (add_member && (! check || ! AppSecInc::LSA::LocalGroup::IsMember(groupname, username)))
{
msiInstall.LogInfo(_T(__FUNCTION__), L"Adding \"" + username + L"\" to \"" + groupname + L"\"");
AppSecInc::LSA::LocalGroup::AddMember(groupname, username);
}
}
MSI_EXCEPTION_HANDLER_EPILOG;
return ERROR_SUCCESS;
}
示例2: testGetAttributeBoolValue
void XmlDocumentUnitTests::testGetAttributeBoolValue()
{
struct testGetAttributeBoolValue_TestData
{
LPCWSTR xpath;
LPCWSTR name;
bool result;
};
std::wstring xmlfile = GetLocalFileLocation(L"store.xml");
std::wcout << std::endl << L"Xml: " << xmlfile.c_str();
AppSecInc::Xml::XmlDocument xml;
xml.Load(xmlfile, CLSID_DOMDocument);
testGetAttributeBoolValue_TestData testdata[] =
{
{ L"/bookstore/book[@id=1]", L"returned", false },
{ L"/bookstore/book[@id=2]", L"returned", true },
};
for (int i = 0; i < ARRAYSIZE(testdata); i++)
{
MSXML2::IXMLDOMNodePtr node = xml.SelectNode(testdata[i].xpath);
// value
bool result_value = xml.GetAttributeBoolValue(testdata[i].name, node);
std::wcout << std::endl << L"Value: " << result_value;
CPPUNIT_ASSERT(testdata[i].result == result_value);
}
}