当前位置: 首页>>代码示例>>C++>>正文


C++ IXMLDOMDocument2Ptr::save方法代码示例

本文整理汇总了C++中msxml2::IXMLDOMDocument2Ptr::save方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMDocument2Ptr::save方法的具体用法?C++ IXMLDOMDocument2Ptr::save怎么用?C++ IXMLDOMDocument2Ptr::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在msxml2::IXMLDOMDocument2Ptr的用法示例。


在下文中一共展示了IXMLDOMDocument2Ptr::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: str

MSXML2::IXMLDOMDocument2Ptr CXmlBase::GetXmlDocPtrByStream(CComBSTR bstrXml
	, CString strXmlPathFile)
{
	CString str(_T(""));
	HRESULT hr = S_OK;
	MSXML2::IXMLDOMDocument2Ptr pDoc;

	//载入到xml文档结构中
	hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
	if (FAILED(hr))
	{
		//WRITELOG("END, FAILED TO INVOKE pDoc.CreateInstance");
		return NULL;
	}

	pDoc->async = VARIANT_FALSE; //加载方式为“同步”
	pDoc->validateOnParse = VARIANT_FALSE; //文档结构有错误时,停止解析。

	if (VARIANT_FALSE == pDoc->loadXML(bstrXml.m_str))
	{
		//WRITELOG("END, FAILED TO INVOKE pDoc->loadXML");
		return NULL;
	}

	if (!strXmlPathFile.IsEmpty())
	{
		if (S_OK != pDoc->save((LPCTSTR)strXmlPathFile))
		{
			//WRITELOG("END, FAILED TO INVOKE pDoc->save");
		}
	}
	return pDoc;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:33,代码来源:XmlBase.cpp

示例2: LoadContent

bool Engine::LoadContent()
{
	// Setup our SpriteBatch.
	m_pSpriteBatch = new DirectX::SpriteBatch(d3dContext_);

	m_pFont->Initialize(d3dDevice_, std::wstring(L"Calibri18.spritefont"));
	m_pSprite->Initialize(d3dDevice_, std::wstring(L"Test.dds"), 10.0f, 10.0f); 
	
	m_textToDisplay = Text();
	m_textToDisplay.Initialize(std::wstring(L"Sarah"), DirectX::SimpleMath::Vector2(200.0f, 200.0f));

	try
	{
		MSXML2::IXMLDOMDocument2Ptr xmlDoc;
		HRESULT hr = xmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60), NULL, CLSCTX_INPROC_SERVER);

		teamStats.InitializeTeam("Players.xml");

		// Make sure the file was loaded correctly before trying to load the players.
		if (xmlDoc->load("Players.xml") == VARIANT_TRUE)
		{
			//xmlDoc->setProperty("SelectionLanguage", "XPath");
			//teamStats.LoadPlayers(xmlDoc);
		}


		if (xmlDoc->load("input.xml") != VARIANT_TRUE)
		{
			DXTRACE_MSG("Unable to load input.xml\n");

			xmlDoc->save("input.xml");
			//xmlDoc->
		}
		else
		{
			DXTRACE_MSG("XML was successfully loaded \n");

			xmlDoc->setProperty("SelectionLanguage", "XPath");
			MSXML2::IXMLDOMNodeListPtr wheels = xmlDoc->selectNodes("/Car/Wheels/*");
			DXTRACE_MSG("Car has %u wheels\n", wheels->Getlength());
		
			DXTRACE_MSG(wheels->Getitem(0)->text);

			//ptr->

			MSXML2::IXMLDOMNodePtr node;
			node = xmlDoc->createNode(MSXML2::NODE_ELEMENT, ("Engine"), (""));
			node->text = ("Engine 1.0");
			xmlDoc->documentElement->appendChild(node);
			hr = xmlDoc->save("output.xml");

			if (SUCCEEDED(hr))
			{
				DXTRACE_MSG("output.xml successfully saved\n");
			}
		}
	}
	catch (_com_error &e)
	{
		DXTRACE_MSG(e.ErrorMessage());
	}










	return true;
}
开发者ID:JoshuaFlitcroft,项目名称:U1150202-FYP,代码行数:73,代码来源:Engine.cpp


注:本文中的msxml2::IXMLDOMDocument2Ptr::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。