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


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

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


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

示例1: save

bool OutXmlSerializer::save(Stream& stream)
{
	XmlDocument doc;

	XmlDeclaration* decl = zenic_new XmlDeclaration;
	decl->setValue("xml");
	decl->setAttribute("version","1.0");
	decl->setAttribute("encoding","ISO-8859-1");
	doc.addChild(decl);

	XmlComment* comment = new XmlComment;
	comment->setValue(" Cell XML Object Graph ");
	doc.addChild(comment);

	// add initial objects

	for (uint i = 0, n = count(); i < n; ++i)
	{
		Serializable* initial = (*this)[i];
		uint j,m;
		for (j = 0, m = m_objects.count(); j < m; ++j)
		{
			if (m_objects[j] == initial)
				break;
		}

		if (j == m_objects.count())
			m_objects.pushBack(initial);
	}

	// build xml tree

	XmlElement* root = new XmlElement;
	root->setValue("zenic");

	for (uint i = 0; i < m_objects.count(); ++i)
	{
		Serializable* object = m_objects[i];
		ZENIC_ASSERT(object);

		m_current = 0;
		m_currentIndex = i;
		object->serialize(*this);

		ZENIC_ASSERT(m_current);
		root->addChild(m_current);
	}

	doc.addChild(root);

	// write tree to stream
	if (!doc.save(stream))
		return false;

	return true;
}
开发者ID:jsvennevid,项目名称:tbl-4edges,代码行数:56,代码来源:OutXmlSerializer.cpp

示例2: main

int main()
{
	XmlDocument doc;

	doc.parse("<?xml version='1.0' encoding='utf-8' ?><command><user>abc</user><pwd>密码</pwd></command>");
	//doc.parse("<command><user>abc</user><pwd>123</pwd></command>");

	//char a[] = "<command><user>abc</user><pwd>123</pwd></command>";
	//doc.parse(a);
	XmlNode command = doc.firstNode("command");
	XmlNode user = command.firstNode("user");
	XmlNode pwd = command.firstNode("pwd");

	KY_LOG_INFO("user: %s pwd: %s", user.text(), pwd.text());
	doc.save("test.xml");
	
	return 0;
}
开发者ID:xuzhixi,项目名称:ops,代码行数:18,代码来源:t_xml5.cpp

示例3: doc

void Executive::requirement4()
{
	std::cout << "\nDemonstrating Requirement 4 : \n";
	std::cout << "============================ \n\n";

	XmlDocument doc(_filePath, XmlDocument::sourceType::filename);
	builder.buildXml(doc);

	std::cout << "\n File Read:\n";
	std::cout << "\nInternal Parse Tree String Representation:";
	std::cout << "\n--------------------------------------------\n\n";
	std::cout << doc << "\n";

	XmlDocument movedDoc(std::move(doc));

	std::cout << "\nMove constructing XmlDocument \n";
	std::cout << "\n--------------------------------------------\n\n";

	std::cout << "\nInternal Parse Tree String Representation:";
	std::cout << "\n--------------------------------------------\n\n";
	std::cout << movedDoc << "\n";
	
	std::cout << "\n Move assigning xmlDocument \n";
	std::cout << "\n--------------------------------------------\n\n";

	XmlDocument emptyDoc;
	
	emptyDoc = std::move(movedDoc);

	std::cout << "\nInternal Parse Tree String Representation:";
	std::cout << "\n--------------------------------------------\n\n";
	std::cout << emptyDoc << "\n"; 
	
	std::cout << "\nSaving to a File \n";
	emptyDoc.save("EmptyXml.xml");

	std::cout << "\n Reading from the saved File \n";

	display.showFileContent("EmptyXml.xml");
	
}
开发者ID:Raag079,项目名称:XML-Document-Model,代码行数:41,代码来源:Executive.cpp


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