亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tutorial0.html

?? 一個小巧、好用的xml文檔 解析器
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>TinyXml: TinyXML Tutorial</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.7 --><div class="tabs">  <ul>    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>    <li><a href="annotated.html"><span>Classes</span></a></li>    <li><a href="files.html"><span>Files</span></a></li>    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>  </ul></div><div class="nav"><a class="el" href="index.html">index</a></div><h1><a class="anchor" name="tutorial0">TinyXML Tutorial</a></h1><h1>What is this? </h1><p>This tutorial has a few tips and suggestions on how to use TinyXML effectively.<p>I've also tried to include some C++ tips like how to convert strings to integers and vice versa. This isn't anything to do with TinyXML itself, but it may helpful for your project so I've put it in anyway.<p>If you don't know basic C++ concepts this tutorial won't be useful. Likewise if you don't know what a DOM is, look elsewhere first.<p><h1>Before we start </h1><p>Some example XML datasets/files will be used.<p>example1.xml:<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;Hello&gt;World&lt;/Hello&gt;</pre></div><p>example2.xml:<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;poetry&gt;	&lt;verse&gt;		Alas		  Great World			Alas (again)	&lt;/verse&gt;&lt;/poetry&gt;</pre></div><p>example3.xml:<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;shapes&gt;	&lt;circle name="int-based" x="20" y="30" r="50" /&gt;	&lt;point name="float-based" x="3.5" y="52.1" /&gt;&lt;/shapes&gt;</pre></div><p>example4.xml<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;MyApp&gt;    &lt;!-- Settings for MyApp --&gt;    &lt;Messages&gt;        &lt;Welcome&gt;Welcome to MyApp&lt;/Welcome&gt;        &lt;Farewell&gt;Thank you for using MyApp&lt;/Farewell&gt;    &lt;/Messages&gt;    &lt;Windows&gt;        &lt;Window name="MainFrame" x="5" y="15" w="400" h="250" /&gt;    &lt;/Windows&gt;    &lt;Connection ip="192.168.0.1" timeout="123.456000" /&gt;&lt;/MyApp&gt;</pre></div><p><h1>Getting Started </h1><p><h2>Load XML from a file </h2><p>The simplest way to load a file into a TinyXML DOM is:<p><div class="fragment"><pre class="fragment">TiXmlDocument doc( "demo.xml" );doc.LoadFile();</pre></div><p>A more real-world usage is shown below. This will load the file and display the contents to STDOUT:<p><div class="fragment"><pre class="fragment">// load the named file and dump its structure to STDOUTvoid dump_to_stdout(const char* pFilename){	TiXmlDocument doc(pFilename);	bool loadOkay = doc.LoadFile();	if (loadOkay)	{		printf("\n%s:\n", pFilename);		dump_to_stdout( &amp;doc ); // defined later in the tutorial	}	else	{		printf("Failed to load file \"%s\"\n", pFilename);	}}</pre></div><p>A simple demonstration of this function is to use a main like this:<p><div class="fragment"><pre class="fragment">int main(void){	dump_to_stdout("example1.xml");	return 0;}</pre></div><p>Recall that Example 1 XML is:<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;Hello&gt;World&lt;/Hello&gt;</pre></div><p>Running the program with this XML will display this in the console/DOS window:<p><div class="fragment"><pre class="fragment">DOCUMENT+ DECLARATION+ ELEMENT Hello  + TEXT[World]</pre></div><p>The ``dump_to_stdout`` function is defined later in this tutorial and is useful if you want to understand recursive traversal of a DOM.<p><h2>Building Documents Programatically </h2><p>This is how to build Example 1 pragmatically:<p><div class="fragment"><pre class="fragment">void build_simple_doc( ){	// Make xml: &lt;?xml ..&gt;&lt;Hello&gt;World&lt;/Hello&gt;	TiXmlDocument doc;	TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );	TiXmlElement * element = new TiXmlElement( "Hello" );	TiXmlText * text = new TiXmlText( "World" );	element-&gt;LinkEndChild( text );	doc.LinkEndChild( decl );	doc.LinkEndChild( element );	doc.SaveFile( "madeByHand.xml" );}</pre></div><p>This can be loaded and displayed on the console with:<p><div class="fragment"><pre class="fragment">dump_to_stdout("madeByHand.xml"); // this func defined later in the tutorial</pre></div><p>and you'll see it is identical to Example 1:<p><div class="fragment"><pre class="fragment">madeByHand.xml:Document+ Declaration+ Element [Hello]  + Text: [World]</pre></div><p>This code produces exactly the same XML DOM but it shows a different ordering to node creation and linking:<p><div class="fragment"><pre class="fragment">void write_simple_doc2( ){	// same as write_simple_doc1 but add each node	// as early as possible into the tree.	TiXmlDocument doc;	TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );	doc.LinkEndChild( decl );		TiXmlElement * element = new TiXmlElement( "Hello" );	doc.LinkEndChild( element );		TiXmlText * text = new TiXmlText( "World" );	element-&gt;LinkEndChild( text );		doc.SaveFile( "madeByHand2.xml" );}</pre></div><p>Both of these produce the same XML, namely:<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;Hello&gt;World&lt;/Hello&gt;</pre></div><p>Or in structure form:<p><div class="fragment"><pre class="fragment">DOCUMENT+ DECLARATION+ ELEMENT Hello  + TEXT[World]</pre></div><p><h2>Attributes </h2><p>Given an existing node, settings attributes is easy:<p><div class="fragment"><pre class="fragment">window = new TiXmlElement( "Demo" );  window-&gt;SetAttribute("name", "Circle");window-&gt;SetAttribute("x", 5);window-&gt;SetAttribute("y", 15);window-&gt;SetDoubleAttribute("radius", 3.14159);</pre></div><p>You can it also work with the <a class="el" href="classTiXmlAttribute.html">TiXmlAttribute</a> objects if you want.<p>The following code shows one way (not the only way) to get all attributes of an element, print the name and string value, and if the value can be converted to an integer or double, print that value too:<p><div class="fragment"><pre class="fragment">// print all attributes of pElement.// returns the number of attributes printedint dump_attribs_to_stdout(TiXmlElement* pElement, unsigned int indent){	if ( !pElement ) return 0;	TiXmlAttribute* pAttrib=pElement-&gt;FirstAttribute();	int i=0;	int ival;	double dval;	const char* pIndent=getIndent(indent);	printf("\n");	while (pAttrib)	{		printf( "%s%s: value=[%s]", pIndent, pAttrib-&gt;Name(), pAttrib-&gt;Value());		if (pAttrib-&gt;QueryIntValue(&amp;ival)==TIXML_SUCCESS)    printf( " int=%d", ival);		if (pAttrib-&gt;QueryDoubleValue(&amp;dval)==TIXML_SUCCESS) printf( " d=%1.1f", dval);		printf( "\n" );		i++;		pAttrib=pAttrib-&gt;Next();	}	return i;}</pre></div><p><h2>Writing a document to a file </h2><p>Writing a pre-built DOM to a file is trivial:<p><div class="fragment"><pre class="fragment">doc.SaveFile( saveFilename );  </pre></div><p>Recall, for example, example 4:<p><div class="fragment"><pre class="fragment">&lt;?xml version="1.0" ?&gt;&lt;MyApp&gt;    &lt;!-- Settings for MyApp --&gt;    &lt;Messages&gt;        &lt;Welcome&gt;Welcome to MyApp&lt;/Welcome&gt;        &lt;Farewell&gt;Thank you for using MyApp&lt;/Farewell&gt;    &lt;/Messages&gt;    &lt;Windows&gt;        &lt;Window name="MainFrame" x="5" y="15" w="400" h="250" /&gt;    &lt;/Windows&gt;    &lt;Connection ip="192.168.0.1" timeout="123.456000" /&gt;&lt;/MyApp&gt;</pre></div><p>The following function builds this DOM and writes the file "appsettings.xml":<p><div class="fragment"><pre class="fragment">void write_app_settings_doc( )  {  	TiXmlDocument doc;  	TiXmlElement* msg; 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );  	doc.LinkEndChild( decl );   	TiXmlElement * root = new TiXmlElement( "MyApp" );  	doc.LinkEndChild( root );  	TiXmlComment * comment = new TiXmlComment();	comment-&gt;SetValue(" Settings for MyApp " );  	root-&gt;LinkEndChild( comment );   	TiXmlElement * msgs = new TiXmlElement( "Messages" );  	root-&gt;LinkEndChild( msgs );   	msg = new TiXmlElement( "Welcome" );  	msg-&gt;LinkEndChild( new TiXmlText( "Welcome to MyApp" ));  	msgs-&gt;LinkEndChild( msg );   	msg = new TiXmlElement( "Farewell" );  	msg-&gt;LinkEndChild( new TiXmlText( "Thank you for using MyApp" ));  	msgs-&gt;LinkEndChild( msg );   	TiXmlElement * windows = new TiXmlElement( "Windows" );  	root-&gt;LinkEndChild( windows );  	TiXmlElement * window;	window = new TiXmlElement( "Window" );  	windows-&gt;LinkEndChild( window );  	window-&gt;SetAttribute("name", "MainFrame");	window-&gt;SetAttribute("x", 5);	window-&gt;SetAttribute("y", 15);	window-&gt;SetAttribute("w", 400);	window-&gt;SetAttribute("h", 250);	TiXmlElement * cxn = new TiXmlElement( "Connection" );  	root-&gt;LinkEndChild( cxn );  	cxn-&gt;SetAttribute("ip", "192.168.0.1");	cxn-&gt;SetDoubleAttribute("timeout", 123.456); // floating point attrib		dump_to_stdout( &amp;doc );	doc.SaveFile( "appsettings.xml" );  } </pre></div><p>The dump_to_stdout function will show this structure:<p><div class="fragment"><pre class="fragment">Document+ Declaration+ Element [MyApp] (No attributes)  + Comment: [ Settings for MyApp ]  + Element [Messages] (No attributes)    + Element [Welcome] (No attributes)      + Text: [Welcome to MyApp]    + Element [Farewell] (No attributes)      + Text: [Thank you for using MyApp]  + Element [Windows] (No attributes)    + Element [Window]      + name: value=[MainFrame]      + x: value=[5] int=5 d=5.0      + y: value=[15] int=15 d=15.0      + w: value=[400] int=400 d=400.0      + h: value=[250] int=250 d=250.0      5 attributes  + Element [Connection]    + ip: value=[192.168.0.1] int=192 d=192.2    + timeout: value=[123.456000] int=123 d=123.5    2 attributes</pre></div><p>I was surprised that TinyXml, by default, writes the XML in what other APIs call a "pretty" format - it modifies the whitespace of text of elements that contain other nodes so that writing the tree includes an indication of nesting level.<p>I haven't looked yet to see if there is a way to turn off indenting when writing a file - its bound to be easy.<p>[Lee: It's easy in STL mode, just use cout &lt;&lt; myDoc. Non-STL mode is always in "pretty" format. Adding a switch would be a nice feature and has been requested.]<p><h1>XML to/from C++ objects </h1><p><h2>Intro </h2><p>This example assumes you're loading and saving your app settings in an XML file, e.g. something like example4.xml.<p>There are a number of ways to do this. For example, look into the TinyBind project at <a href="http://sourceforge.net/projects/tinybind">http://sourceforge.net/projects/tinybind</a><p>This section shows a plain-old approach to loading and saving a basic object structure using XML.<p><h2>Set up your object classes </h2><p>Start off with some basic classes like these:<p><div class="fragment"><pre class="fragment">#include &lt;string&gt;#include &lt;map&gt;using namespace std;typedef std::map&lt;std::string,std::string&gt; MessageMap;// a basic window abstraction - demo purposes onlyclass WindowSettings{public:	int x,y,w,h;	string name;	WindowSettings()		: x(0), y(0), w(100), h(100), name("Untitled")	{	}	WindowSettings(int x, int y, int w, int h, const string&amp; name)	{		this-&gt;x=x;		this-&gt;y=y;		this-&gt;w=w;		this-&gt;h=h;		this-&gt;name=name;	}};class ConnectionSettings{public:	string ip;	double timeout;};class AppSettings{public:	string m_name;	MessageMap m_messages;	list&lt;WindowSettings&gt; m_windows;	ConnectionSettings m_connection;	AppSettings() {}	void save(const char* pFilename);	void load(const char* pFilename);		// just to show how to do it	void setDemoValues()	{		m_name="MyApp";		m_messages.clear();		m_messages["Welcome"]="Welcome to "+m_name;		m_messages["Farewell"]="Thank you for using "+m_name;		m_windows.clear();		m_windows.push_back(WindowSettings(15,15,400,250,"Main"));		m_connection.ip="Unknown";		m_connection.timeout=123.456;	}};

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本丰满少妇一区二区三区| 夜夜嗨av一区二区三区中文字幕| 日本美女视频一区二区| 91麻豆精品国产91久久久久久| 亚洲婷婷综合色高清在线| 99久久精品99国产精品| 亚洲激情av在线| 欧美日韩1区2区| 免费人成在线不卡| 精品久久久久久久久久久久久久久久久 | 免费视频最近日韩| 久久综合色之久久综合| 国产成人av一区二区三区在线| 国产人伦精品一区二区| 99久免费精品视频在线观看| 一区二区三区精密机械公司| 欧美日韩日日骚| 另类小说综合欧美亚洲| 久久久www成人免费无遮挡大片| 国产传媒久久文化传媒| 亚洲天堂成人在线观看| 欧美美女直播网站| 麻豆免费精品视频| 中文字幕精品综合| 欧美三级日韩三级国产三级| 精品亚洲porn| 最新中文字幕一区二区三区| 欧美亚日韩国产aⅴ精品中极品| 日韩精品亚洲专区| 久久久国产综合精品女国产盗摄| 色婷婷综合久久久久中文一区二区| 亚洲成a人v欧美综合天堂| 日韩色视频在线观看| 成人看片黄a免费看在线| 亚洲图片自拍偷拍| 国产欧美日韩精品a在线观看| 99国产欧美另类久久久精品| 日韩av不卡一区二区| 亚洲国产成人在线| 日韩一区二区视频在线观看| 色综合天天在线| 国产自产高清不卡| 一区二区三区欧美亚洲| 久久久久九九视频| 在线电影一区二区三区| 99久久伊人精品| 精品一区二区免费在线观看| 亚洲午夜在线观看视频在线| 亚洲国产成人自拍| 欧美白人最猛性xxxxx69交| 色婷婷激情综合| 成人精品视频一区二区三区| 日韩二区三区四区| 亚洲综合久久av| 中文字幕一区二区三区色视频| 精品久久久久久久久久久久久久久| 欧美三级视频在线播放| 91视频在线看| 懂色av一区二区夜夜嗨| 国产精一区二区三区| 美洲天堂一区二卡三卡四卡视频| 亚洲一区二三区| 亚洲欧美日韩电影| 国产精品美女久久久久aⅴ| 精品国产区一区| 日韩一区二区三区高清免费看看| 精品视频在线视频| 91久久久免费一区二区| 一本久久综合亚洲鲁鲁五月天 | 色综合久久综合网欧美综合网 | 国产精品一区二区三区乱码| 青青草成人在线观看| 亚洲午夜激情网站| 一区二区三区在线播放| 综合久久国产九一剧情麻豆| 国产精品免费久久| 中文字幕国产一区| 国产精品色哟哟| 国产精品素人一区二区| 国产精品人妖ts系列视频| 国产日本欧洲亚洲| 亚洲国产精品黑人久久久| 中文字幕欧美三区| 国产精品久久久久久久浪潮网站| 日本一区二区三区四区 | 日韩一区二区三区视频| 777午夜精品免费视频| 欧美精品免费视频| 91精品欧美福利在线观看| 欧美一区二区视频在线观看2022 | 欧美成人一区二区三区| 成人免费在线播放视频| 亚洲人成网站色在线观看| 亚洲男同性视频| 亚洲成人www| 麻豆国产欧美日韩综合精品二区| 久久黄色级2电影| 国产精品亚洲综合一区在线观看| 国产成人亚洲综合色影视| 99精品黄色片免费大全| 欧美日韩一本到| 精品日韩在线一区| 亚洲国产激情av| 亚洲一区二区三区四区中文字幕| 日韩黄色片在线观看| 国产精品一二三在| 91影视在线播放| 欧美日韩成人在线一区| 久久先锋影音av鲁色资源网| 国产精品久久久久久亚洲伦 | 午夜免费欧美电影| 久久精品久久精品| 成人午夜在线视频| 欧美日韩aaa| 国产日韩成人精品| 亚洲一区二区三区激情| 精品一二线国产| 色域天天综合网| 日韩亚洲欧美综合| 亚洲视频你懂的| 久久精品国产亚洲高清剧情介绍| 粉嫩13p一区二区三区| 欧美三级视频在线播放| 久久久99免费| 亚洲成人自拍网| 成人性生交大片| 91精品国产美女浴室洗澡无遮挡| 国产欧美一区二区精品秋霞影院| 亚洲成av人片一区二区| 国产精品影视在线观看| 欧美精品高清视频| 国产精品二区一区二区aⅴ污介绍| 日韩精品色哟哟| 不卡av在线网| 精品少妇一区二区三区日产乱码| 日韩伦理电影网| 国产一区二区电影| 欧美美女bb生活片| 亚洲丝袜精品丝袜在线| 精品一区二区三区视频在线观看 | 欧美丝袜第三区| 日本一区二区三区四区在线视频 | 久久精品理论片| 亚洲色图一区二区| 国产一区二区三区免费看| 欧美日本不卡视频| 亚洲精品视频自拍| 成人动漫在线一区| 欧美精品一区二区三区高清aⅴ | 亚洲精选在线视频| 国产激情偷乱视频一区二区三区| 7777精品伊人久久久大香线蕉超级流畅 | 91农村精品一区二区在线| 久久久精品天堂| 久久精品国产网站| 91精品国产欧美一区二区成人 | 久久久亚洲精品石原莉奈| 亚洲第一福利一区| 色婷婷综合久久久久中文一区二区| 中文一区一区三区高中清不卡| 久久爱另类一区二区小说| 日韩一区二区三区高清免费看看| 亚洲国产精品视频| 欧美中文字幕一区二区三区 | 高清不卡一区二区| 国产性天天综合网| 韩国在线一区二区| 欧美成人一区二区| 国内精品伊人久久久久av一坑| 精品粉嫩aⅴ一区二区三区四区| 另类的小说在线视频另类成人小视频在线| 欧美少妇xxx| 视频一区二区国产| 欧美不卡一区二区三区| 国内精品伊人久久久久av影院| 精品乱人伦小说| 国产精品主播直播| 国产午夜精品久久| 不卡视频免费播放| 专区另类欧美日韩| 在线观看一区不卡| 日韩国产欧美在线视频| 欧美一区二区视频网站| 另类欧美日韩国产在线| 久久精品这里都是精品| 东方aⅴ免费观看久久av| 一区在线观看视频| 欧美在线观看视频在线| 五月天激情小说综合| 日韩亚洲欧美一区二区三区| 激情综合色综合久久综合| 国产欧美久久久精品影院| 91免费视频网| 免费看欧美女人艹b| 久久久美女艺术照精彩视频福利播放| 成人综合婷婷国产精品久久| 一区二区三区四区视频精品免费 | 婷婷综合久久一区二区三区| 欧美一区日韩一区| 国产成人小视频|