本文整理汇总了C++中msxml2::IXMLDOMNode::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNode::Release方法的具体用法?C++ IXMLDOMNode::Release怎么用?C++ IXMLDOMNode::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNode
的用法示例。
在下文中一共展示了IXMLDOMNode::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteTimeEntry
void PlanEntryModelManager::DeleteTimeEntry(unsigned __int64 id)
{
EnterCriticalSection(&critical_section);
MSXML2::IXMLDOMNode *pNode = 0;
StringBuffer conv(32);
StringBuffer sb(_T("//timeentry[@entryid=\""));
sb.append(ModelUtils::toHexString(id, conv));
sb.append(_T("\"]"));
BSTR xpath = SysAllocString(sb);
HRESULT hr = m_pXMLDoc->selectSingleNode(xpath, &pNode);
SysFreeString(xpath);
if(hr == S_OK && pNode)
{
MSXML2::IXMLDOMNode *pOld = 0;
hr = m_pRoot->removeChild(pNode, &pOld);
if(hr == S_OK)
{
pOld->Release();
TimeEntryEvent tee(TimeEntryEvent::TIME_ENTRY_DELETE, id);
NotifyChanged(tee);
}
pNode->Release();
}
LeaveCriticalSection(&critical_section);
}
示例2: Parse
void XmlParser::Parse(NodeCallback callback, void *data)
{
MSXML2::IXMLDOMNodeListPtr NodeListPtr;
BSTR strFindText = L" ";
MSXML2::IXMLDOMNode *pIDOMNode = NULL;
BSTR bstrNodeType;
assert(m_domDocument != NULL);
NodeListPtr = m_domDocument->getElementsByTagName(strFindText);
for(int i = 0; i < NodeListPtr->length; i++)
{
if (pIDOMNode)
pIDOMNode->Release();
NodeListPtr->get_item(i, &pIDOMNode);
pIDOMNode->get_nodeTypeString(&bstrNodeType);
if (lstrcmp((LPCTSTR)bstrNodeType, (LPCTSTR)L"element") != 0)
continue;
XmlNode node;
_parseNode(pIDOMNode, node);
if (callback(node, data) == false)
break;
}
if (pIDOMNode)
pIDOMNode->Release();
}
示例3: CreateRecurrence
void RecurrenceManager::CreateRecurrence(const TCHAR *type, const TCHAR *title, const TCHAR *desc, unsigned __int64 parentId,
bool sunday, bool monday, bool tuesday, bool wednesday, bool thursday, bool friday, bool saturday,
unsigned short starthour, unsigned short startminute, int duration)
{
MSXML2::IXMLDOMNode *pRecurrence = 0;
HRESULT hr = XMLHelper::CreateChild(GetRecurrencesNode(), &pRecurrence, _T("recurrence"));
if(S_OK == hr && pRecurrence)
{
XMLHelper::SetAttribute(pRecurrence, _T("type"), type);
XMLHelper::SetAttributeI64(pRecurrence, _T("recurrenceid"), ModelUtils::GenerateID());
XMLHelper::SetAttributeI64(pRecurrence, _T("parentid"), parentId);
MSXML2::IXMLDOMNode *pNode = 0;
hr = XMLHelper::CreateChild(pRecurrence, &pNode, _T("title"), title);
if(S_OK == hr && pNode)
{
pNode->Release();
}
pNode = 0;
hr = XMLHelper::CreateChild(pRecurrence, &pNode, _T("desc"), desc);
if(S_OK == hr && pNode)
{
pNode->Release();
}
CreateSchedule(pRecurrence, sunday, monday, tuesday, wednesday, thursday, friday, saturday, starthour, startminute, duration);
}
}
示例4: GetAttribute
HRESULT XMLHelper::GetAttribute(MSXML2::IXMLDOMNode *pNode, const TCHAR *pAttr, int *pVal)
{
MSXML2::IXMLDOMNamedNodeMap *pAttrMap = 0;
HRESULT hr = pNode->get_attributes(&pAttrMap);
if(hr == S_OK)
{
BSTR attr = SysAllocString(pAttr);
MSXML2::IXMLDOMNode *pAttrNode = 0;
hr = pAttrMap->getNamedItem(attr, &pAttrNode);
SysFreeString(attr);
if(hr == S_OK && pAttrNode)
{
VARIANTARG varg;
VariantInit(&varg);
hr = pAttrNode->get_nodeValue(&varg);
if(hr == S_OK && varg.vt == VT_BSTR)
{
*pVal = varg.bstrVal? _wtoi(varg.bstrVal): 0;
SysFreeString(varg.bstrVal);
}
pAttrNode->Release();
}
pAttrMap->Release();
}
return hr;
}
示例5: RealizeRecurrences
//The big issue here will be the whether the input time is local or UTC, there could be problems
//between users in different timezones and the proper realization of template...
//TODO: review code to ensure template is realized properly
void RecurrenceManager::RealizeRecurrences(unsigned __int64 date)
{
if(date > m_pDataManager->GetDayManagerInstance()->GetToday() - 1)
{
SYSTEMTIME st = ModelUtils::I64ToSystemTime(date);
StringBuffer sb(_T("//recurrence[schedule/@"));
sb.append(days[st.wDayOfWeek]);
sb.append(_T("='true']"));
BSTR xpath = SysAllocString(sb);
MSXML2::IXMLDOMNodeList *pList = 0;
HRESULT hr = m_pXMLDoc->selectNodes(xpath, &pList);
if(hr == S_OK && pList)
{
MSXML2::IXMLDOMNode *pNode = 0;
while((hr = pList->nextNode(&pNode)) == S_OK)
{
RealizeRecurrence(pNode, st);
pNode->Release();
}
pList->Release();
}
}
}
示例6: GetAllPrerequisites
//TODO: review usage of TaskIDSet, in particular the local allocation and copying of contents
Task::TaskIDSet CTaskModel::GetAllPrerequisites()
{
TaskIDSet ts;
MSXML2::IXMLDOMNodeList *pNodeList = 0;
BSTR xpath = SysAllocString(_T("ancestor-or-self::task/prerequisite"));
HRESULT hr = m_pNode->selectNodes(xpath, &pNodeList);
SysFreeString(xpath);
MSXML2::IXMLDOMNode *pNode = 0;
unsigned __int64 id = 0;
BSTR bstr = 0;
if(pNodeList)
{
while((hr = pNodeList->nextNode(&pNode)) == S_OK)
{
if(pNode)
{
hr = XMLHelper::GetAttribute(pNode, _T("taskid"), &bstr);
if(hr == S_OK)
{
id = ModelUtils::fromHexString(bstr, wcslen(bstr));
ts.Add(id);
id = 0;
SysFreeString(bstr);
}
bstr = 0;
pNode->Release();
pNode = 0;
}
}
pNodeList->Release();
}
return ts;
}
示例7: CreateSchedule
void RecurrenceManager::CreateSchedule(MSXML2::IXMLDOMNode *pRecurrence, bool sunday, bool monday, bool tuesday, bool wednesday, bool thursday, bool friday, bool saturday,
unsigned short starthour, unsigned short startminute, int duration)
{
MSXML2::IXMLDOMNode *pNode = 0;
HRESULT hr = XMLHelper::CreateChild(pRecurrence, &pNode, _T("schedule"));
if(S_OK == hr && pNode)
{
if(sunday)XMLHelper::SetAttribute(pNode, days[0], _T("true"));
if(monday)XMLHelper::SetAttribute(pNode, days[1], _T("true"));
if(tuesday)XMLHelper::SetAttribute(pNode, days[2], _T("true"));
if(wednesday)XMLHelper::SetAttribute(pNode, days[3], _T("true"));
if(thursday)XMLHelper::SetAttribute(pNode, days[4], _T("true"));
if(friday)XMLHelper::SetAttribute(pNode, days[5], _T("true"));
if(saturday)XMLHelper::SetAttribute(pNode, days[6], _T("true"));
StringBuffer sb(16);
sb.appendInt(starthour);
XMLHelper::SetAttribute(pNode, _T("starthour"), sb);
sb.flush();
sb.appendInt(startminute);
XMLHelper::SetAttribute(pNode, _T("startminute"), sb);
sb.flush();
sb.appendInt(duration);
XMLHelper::SetAttribute(pNode, _T("duration"), sb);
pNode->Release();
}
}
示例8: SysAllocString
XmlFixture::XmlFixture()
{
OleInitialize(0);
CoCreateInstance(__uuidof(MSXML2::FreeThreadedDOMDocument60), NULL,
CLSCTX_SERVER, __uuidof(MSXML2::IXMLDOMDocument2), reinterpret_cast<void **>(&doc));
BSTR prop = SysAllocString(_T("SelectionNamespaces"));
VARIANTARG varg;
VariantInit(&varg);
varg.vt = VT_BSTR;
varg.bstrVal = SysAllocString(_T("xmlns:ms='urn:schemas-microsoft-com:xslt'"));
doc->setProperty(prop, varg);
VariantInit(&varg);
varg.vt = VT_I2;
varg.iVal = MSXML2::NODE_ELEMENT;
BSTR EMPTY_STR = SysAllocString(_T(""));
BSTR rootStr = SysAllocString(_T("tasktracker"));
HRESULT hr = doc->createNode(varg, rootStr, EMPTY_STR, &root);
SysFreeString(rootStr);
SysFreeString(EMPTY_STR);
if(hr == S_OK && root)
{
MSXML2::IXMLDOMNode *pOut = 0;
hr = doc->appendChild(root, &pOut);
if(hr == S_OK && pOut)
{
pOut->Release();
pOut = 0;
}
}
}
示例9: SysAllocString
TEST_FIXTURE(XmlFixture, CreateChild2)
{
MSXML2::IXMLDOMNode *node = 0;
HRESULT hr = XMLHelper::CreateChild(root, &node, _T("test"));
CHECK_OK(hr);
CHECK(node);
node->Release();
node = 0;
BSTR query = SysAllocString(_T("//test"));
MSXML2::IXMLDOMNodeList *nodeList = 0;
hr = doc->selectNodes(query, &nodeList);
SysFreeString(query);
CHECK_OK(hr);
CHECK(nodeList);
long length = 0;
hr = nodeList->get_length(&length);
CHECK_OK(hr);
CHECK_EQUAL(1, length);
hr = nodeList->nextNode(&node);
CHECK_OK(hr);
CHECK(node);
BSTR name = 0;
hr = node->get_nodeName(&name);
CHECK_OK(hr);
CHECK_EQUAL(0, _tcscmp(name, _T("test")));
SysFreeString(name);
}
示例10: SysAllocString
Task::TaskSet * CTaskModel::GetChildren(Task::TaskSet *pSet)
{
//if(!m_pTaskManager)return pSet;
MSXML2::IXMLDOMNodeList *pNodeList = 0;
BSTR xpath = SysAllocString(_T("./task"));
HRESULT hr = m_pNode->selectNodes(xpath, &pNodeList);
SysFreeString(xpath);
MSXML2::IXMLDOMNode *pNode = 0;
if(pNodeList)
{
while((hr = pNodeList->nextNode(&pNode)) == S_OK)
{
unsigned __int64 childID = 0;
XMLHelper::GetAttributeI64(pNode, TASKID, &childID);
Task *pTask = new(childID) CTaskModel(pNode);
if(pTask)
{
pSet->Add(*pTask);
}
pNode->Release();
pNode = 0;
}
}
pNodeList->Release();
pNodeList = 0;
return pSet;
}
示例11:
TEST_FIXTURE(XmlFixture, CreateChild)
{
MSXML2::IXMLDOMNode *node = 0;
HRESULT hr = XMLHelper::CreateChild(root, &node, _T("test"));
CHECK_OK(hr);
CHECK(node);
node->Release();
}
示例12: tee
TimeEntry * PlanEntryModelManager::CreateTimeEntry(
unsigned __int64 taskID, unsigned __int64 start, unsigned __int64 stop, TCHAR *pTaskname)
{
MSXML2::IXMLDOMNode *pNode = CreateEntryNode();
TimeEntry *pEntry = new(pNode) PlanEntryModel(pNode, start, stop, taskID, m_pDataManager->GetUsername(), pTaskname);
pNode->Release();
if(pEntry)
{
TimeEntryEvent tee(TimeEntryEvent::TIME_ENTRY_ADD, pEntry->GetID(), pEntry);
NotifyChanged(tee);
}
return pEntry;
}
示例13: GetChildText
HRESULT XMLHelper::GetChildText(MSXML2::IXMLDOMNode *pNode, const TCHAR *pChild, BSTR *pBstr)
{
BSTR xpath = SysAllocString(pChild);
MSXML2::IXMLDOMNode *pChildNode = 0;
HRESULT hr = pNode->selectSingleNode(xpath, &pChildNode);
SysFreeString(xpath);
if(hr == S_OK && pChildNode)
{
hr = pChildNode->get_text(pBstr);
pChildNode->Release();
}
return hr;
}
示例14: AddPrerequisite
void CTaskModel::AddPrerequisite(unsigned __int64 prereq)
{
//AddPrerequisite(prereq, true);
MSXML2::IXMLDOMNode *pNode = 0;
HRESULT hr = AppendChild(&pNode, PREREQUISITE);
if(hr == S_OK && pNode)
{
StringBuffer temp(32);
XMLHelper::SetAttribute(pNode, TASKID, ModelUtils::toHexString(prereq, temp));
pNode->Release();
}
//TODO: notify?..
}
示例15: new
TEST_FIXTURE(XmlFixture, AllocationMapCleaned)
{
MSXML2::IXMLDOMNode *taskNode = 0;
for(unsigned __int64 id = 1; id < 100; ++id)
{
HRESULT hr = XMLHelper::CreateChild(root, &taskNode, _T("task"));
CHECK_OK(hr);
CTaskModel * tm = new(id) CTaskModel(taskNode, id, 0, _T("Test"), _T("Test"), _T("Test"), 0, 0, 0, 0, 0, false, 3, TASK_STATE_OPEN);
CHECK(tm);
delete tm;
taskNode->Release();
taskNode = 0;
}
CHECK_EQUAL(0, TaskModelInternalTester::GetAllocationMapCount());
}