<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[tinyxml -&amp;gt; wie richtig parsen?]]></title><description><![CDATA[<p>hoi ich habe eine xml file die folgende struktur aufweist:</p>
<pre><code class="language-cpp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; standalone=&quot;yes&quot; ?&gt;
	&lt;unitlist&gt;
		&lt;Unit Name=&quot;name1&quot;&gt;
            		&lt;element1&gt;1&lt;/element1&gt;
            		&lt;element2&gt;1&lt;/element2&gt;
	            	&lt;Preis&gt;4&lt;/Preis&gt;
            	&lt;/Unit&gt;         	
            	&lt;Unit Name=&quot;name2&quot;&gt;
		      	&lt;element1&gt;1&lt;/element2&gt;
            		&lt;element2&gt;4&lt;/element2&gt;
            		&lt;element3&gt;1&lt;/element3&gt;
            		&lt;Preis&gt;3&lt;/Preis&gt;
         		&lt;/Unit&gt;
                  ...
</code></pre>
<p>jetzt habe ich tinyxml genommen und das einlesen scheint auch zu klappen nur wie komme ich an den inhalt der elemente der einzelnen units? den Name kann ich schon auslesen.</p>
<p>bisher kamm ich über den value aufruf eines childs nur an den elementnamen herran, sprich element 1.</p>
<p>was mach ich falsch bzw was mache ich nicht?</p>
<pre><code class="language-cpp">TiXmlHandle docHandle( &amp;document );
    TiXmlElement* child2 = docHandle.FirstChild( &quot;unitlist&quot; ).FirstChild \\
    ( &quot;Unit&quot; ).Child( &quot;Preis&quot;, 0 ).Element();
    if ( child2 )
    {
         metst-&gt;Lines-&gt;Add( child2-&gt;Value());
    }
</code></pre>
<p>mfg</p>
<p>spool</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/76977/tinyxml-gt-wie-richtig-parsen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 29 Jun 2026 04:39:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/76977.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Jun 2004 14:05:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to tinyxml -&amp;gt; wie richtig parsen? on Thu, 17 Jun 2004 07:15:26 GMT]]></title><description><![CDATA[<p>hoi ich habe eine xml file die folgende struktur aufweist:</p>
<pre><code class="language-cpp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; standalone=&quot;yes&quot; ?&gt;
	&lt;unitlist&gt;
		&lt;Unit Name=&quot;name1&quot;&gt;
            		&lt;element1&gt;1&lt;/element1&gt;
            		&lt;element2&gt;1&lt;/element2&gt;
	            	&lt;Preis&gt;4&lt;/Preis&gt;
            	&lt;/Unit&gt;         	
            	&lt;Unit Name=&quot;name2&quot;&gt;
		      	&lt;element1&gt;1&lt;/element2&gt;
            		&lt;element2&gt;4&lt;/element2&gt;
            		&lt;element3&gt;1&lt;/element3&gt;
            		&lt;Preis&gt;3&lt;/Preis&gt;
         		&lt;/Unit&gt;
                  ...
</code></pre>
<p>jetzt habe ich tinyxml genommen und das einlesen scheint auch zu klappen nur wie komme ich an den inhalt der elemente der einzelnen units? den Name kann ich schon auslesen.</p>
<p>bisher kamm ich über den value aufruf eines childs nur an den elementnamen herran, sprich element 1.</p>
<p>was mach ich falsch bzw was mache ich nicht?</p>
<pre><code class="language-cpp">TiXmlHandle docHandle( &amp;document );
    TiXmlElement* child2 = docHandle.FirstChild( &quot;unitlist&quot; ).FirstChild \\
    ( &quot;Unit&quot; ).Child( &quot;Preis&quot;, 0 ).Element();
    if ( child2 )
    {
         metst-&gt;Lines-&gt;Add( child2-&gt;Value());
    }
</code></pre>
<p>mfg</p>
<p>spool</p>
]]></description><link>https://www.c-plusplus.net/forum/post/541630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/541630</guid><dc:creator><![CDATA[chickonspeed]]></dc:creator><pubDate>Thu, 17 Jun 2004 07:15:26 GMT</pubDate></item><item><title><![CDATA[Reply to tinyxml -&amp;gt; wie richtig parsen? on Thu, 17 Jun 2004 14:12:44 GMT]]></title><description><![CDATA[<p>hat sich erledigt.</p>
<p>wens interesiert folgender code vereinfacht das ganze</p>
<pre><code class="language-cpp">const char * GetTextChild (TiXmlElement * mother)
{
      if (! mother || ! (mother -&gt; FirstChild ()) || ! (mother -&gt; FirstChild () -&gt; ToText ()) || ! (mother -&gt; FirstChild () -&gt; ToText () -&gt; Value ()))
         return &quot;&quot;;

      return mother -&gt; FirstChild () -&gt; ToText () -&gt; Value ();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/542445</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/542445</guid><dc:creator><![CDATA[chickonspeed]]></dc:creator><pubDate>Thu, 17 Jun 2004 14:12:44 GMT</pubDate></item></channel></rss>