<?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[C++ TinyXML]]></title><description><![CDATA[<p>Hi Leute<br />
Ich versuch ein einer Datei die Anzahl von Namen herraus zu finden. Ich hab in einer Datei stehen.<br />
Beispiel:</p>
<pre><code>&lt;1NAME&gt;asdas&lt;/1NAME&gt;

&lt;2NAME&gt;asdas&lt;/2NAME&gt;

&lt;3NAME&gt;asdas&lt;/3NAME&gt;

&lt;4NAME&gt;asdas&lt;/4NAME&gt;
</code></pre>
<p>Jetzt möcht ich herrausfinden wie viele Namen es gibt denn es werden immer unterschiedlich viel geben.</p>
<p>Hier noch der Quelltext:<br />
game.hpp</p>
<pre><code class="language-cpp">#ifndef GAME_HPP_INCLUDED
#define GAME_HPP_INCLUDED

#define MYSQLPP_MYSQL_HEADERS_BURIED
#include &lt;mysql++/mysql++.h&gt;

#define TIXML_USE_STL
#include &lt;tinyxml.h&gt;

#include &lt;string&gt;
#include &lt;sstream&gt;

class Game
{
    public:
    int self_list();
};

#endif // GAME_HPP_INCLUDED
</code></pre>
<p>game.cpp</p>
<pre><code class="language-cpp">#include &quot;game.hpp&quot;

int Game::self_list()
{
    int i, anzahl;
    std::string search_number, name;

    TiXmlDocument doc(&quot;./config/self.conf&quot;);
    TiXmlNode *search_elem;

    if(!doc.LoadFile())
    {
        return -1;
    }

    for(i=1; search_elem != 0; i++)
    {
        std::ostringstream outstream;
        outstream &lt;&lt; i;
        search_number = outstream.str();

        name = search_number + &quot;NAME&quot;;
        search_elem = doc.FirstChild(name);

std::cout &lt;&lt; name &lt;&lt; std::endl;
        anzahl = i;
    }

    return anzahl;
}
</code></pre>
<p>Ich hoffe ihr wisst was ich meine und könnt mir helfen.</p>
<p>Gruß,<br />
Nico</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/273864/c-tinyxml</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 21:45:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/273864.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Sep 2010 16:00:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ TinyXML on Tue, 14 Sep 2010 16:01:05 GMT]]></title><description><![CDATA[<p>Hi Leute<br />
Ich versuch ein einer Datei die Anzahl von Namen herraus zu finden. Ich hab in einer Datei stehen.<br />
Beispiel:</p>
<pre><code>&lt;1NAME&gt;asdas&lt;/1NAME&gt;

&lt;2NAME&gt;asdas&lt;/2NAME&gt;

&lt;3NAME&gt;asdas&lt;/3NAME&gt;

&lt;4NAME&gt;asdas&lt;/4NAME&gt;
</code></pre>
<p>Jetzt möcht ich herrausfinden wie viele Namen es gibt denn es werden immer unterschiedlich viel geben.</p>
<p>Hier noch der Quelltext:<br />
game.hpp</p>
<pre><code class="language-cpp">#ifndef GAME_HPP_INCLUDED
#define GAME_HPP_INCLUDED

#define MYSQLPP_MYSQL_HEADERS_BURIED
#include &lt;mysql++/mysql++.h&gt;

#define TIXML_USE_STL
#include &lt;tinyxml.h&gt;

#include &lt;string&gt;
#include &lt;sstream&gt;

class Game
{
    public:
    int self_list();
};

#endif // GAME_HPP_INCLUDED
</code></pre>
<p>game.cpp</p>
<pre><code class="language-cpp">#include &quot;game.hpp&quot;

int Game::self_list()
{
    int i, anzahl;
    std::string search_number, name;

    TiXmlDocument doc(&quot;./config/self.conf&quot;);
    TiXmlNode *search_elem;

    if(!doc.LoadFile())
    {
        return -1;
    }

    for(i=1; search_elem != 0; i++)
    {
        std::ostringstream outstream;
        outstream &lt;&lt; i;
        search_number = outstream.str();

        name = search_number + &quot;NAME&quot;;
        search_elem = doc.FirstChild(name);

std::cout &lt;&lt; name &lt;&lt; std::endl;
        anzahl = i;
    }

    return anzahl;
}
</code></pre>
<p>Ich hoffe ihr wisst was ich meine und könnt mir helfen.</p>
<p>Gruß,<br />
Nico</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952560</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Tue, 14 Sep 2010 16:01:05 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Tue, 14 Sep 2010 16:07:18 GMT]]></title><description><![CDATA[<p>1. Durchgang: name == 1NAME, ist vorhanden, anzahl = 1, search_elem !=0<br />
2. Durchgang: name == 2NAME, ist vorhanden, anzahl = 2, search_elem !=0<br />
3. Durchgang: name == 3NAME, ist vorhanden, anzahl = 3, search_elem !=0<br />
4. Durchgang: name == 4NAME, ist vorhanden, anzahl = 4, search_elem !=0<br />
5. Durchgang: name == 5NAME, ist nicht vorhanden, anzahl = 5, search_elem ==0 --&gt; Abbruch</p>
<p>5 wird ausgegeben ... höchstens die Logic ist schief ... aber die war schon bei dem XML Input schräg <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952563</guid><dc:creator><![CDATA[padreigh]]></dc:creator><pubDate>Tue, 14 Sep 2010 16:07:18 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Tue, 14 Sep 2010 16:07:59 GMT]]></title><description><![CDATA[<p>Und worin liegt das Problem? Und wer macht eine XML Datei mit mehreren gleichen Elementen, gibt aber jedem Element einen anderen Namen?</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952564</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Tue, 14 Sep 2010 16:07:59 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Tue, 14 Sep 2010 16:08:11 GMT]]></title><description><![CDATA[<p>Statt Xml-Elemente mit unterschiedlichem Name zu produzieren, wäre es deutlich besser, die Zahl wegzulassen. Willst du eine identifizierung zulassen, gibt dem Element ein Attribut &quot;Nummer&quot;.</p>
<pre><code>&lt;NAME&gt;asdas&lt;/NAME&gt;
&lt;NAME&gt;asdas&lt;/NAME&gt;
&lt;NAME&gt;asdas&lt;/NAME&gt;
&lt;NAME&gt;asdas&lt;/NAME&gt;

// Und mit Attributen:
&lt;NAME Nummer=&quot;1&quot;&gt;asdas&lt;/NAME&gt;
&lt;NAME Nummer=&quot;2&quot;&gt;asdas&lt;/NAME&gt;
&lt;NAME Nummer=&quot;3&quot;&gt;asdas&lt;/NAME&gt;
&lt;NAME Nummer=&quot;4&quot;&gt;asdas&lt;/NAME&gt;
</code></pre>
<p>Zum Abzählen einfach in der Schleife die &quot;FindNextElement(&quot;NAME&quot;)&quot;-Funktion aufrufen (weiß nicht wie die bei TiXML heißt, evtl. gibts ja sogar nen NodeIterator - vllt. sogar gleich mit passendem Filter für die NodeName :)).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952565</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952565</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Tue, 14 Sep 2010 16:08:11 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Tue, 14 Sep 2010 16:35:49 GMT]]></title><description><![CDATA[<p>Ja stimm zu das die namens wahl nich gerade gut ist :D.<br />
Mein Problem ist das bei mir nur 2 Element ausgegeben werden und dann wird abgebrochen.</p>
<p>@ l'abra d'or<br />
Ich weiß nicht ob es sowas gibt wie FindNextElement(&quot;NAME&quot;) in Tinyxml gib muss ich mal schauen.</p>
<p>Edit:<br />
Ich hab deswegen verschiedene Zahlen vor NAME weil ich später eine auflistung hab mit den Namen der Spiele und wenn man auf die Namen der Spiele klickt wird das Spiel gestartet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952579</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952579</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Tue, 14 Sep 2010 16:35:49 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Tue, 14 Sep 2010 17:35:25 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>Ich hab deswegen verschiedene Zahlen vor NAME weil ich später eine auflistung hab mit den Namen der Spiele und wenn man auf die Namen der Spiele klickt wird das Spiel gestartet.</p>
</blockquote>
<p>Macht immer noch keinen Sinn. In diesem Fall wäre es wohl eher sowas:</p>
<pre><code class="language-html">&lt;Games&gt;
  &lt;Game Name=&quot;Landwirtschaft-Simulator&quot; Path=&quot;X:/some/garbage.exe&quot; /&gt;
  &lt;!-- ... --&gt;
&lt;/Games&gt;
</code></pre>
<p>Wenn du willst, kannst du jedem Game-Element noch eine ID verpassen. Aber speichere nie Daten in den Namen eines Elements.</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952606</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Tue, 14 Sep 2010 17:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Wed, 15 Sep 2010 05:37:53 GMT]]></title><description><![CDATA[<p>Also die Zahlen sollten eigendlich die ID sein.</p>
<p>@ Dravere<br />
Dein Beispiel gefällt mir ich versuch das umzu setzen danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952763</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Wed, 15 Sep 2010 05:37:53 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Wed, 15 Sep 2010 15:01:04 GMT]]></title><description><![CDATA[<p>Ich würde dir statt TinyXml Boost.PropertyTree empfehlen:<br />
<a href="http://www.boost.org/doc/libs/1_44_0/doc/html/property_tree.html" rel="nofollow">http://www.boost.org/doc/libs/1_44_0/doc/html/property_tree.html</a><br />
<a href="http://www.boost.org/doc/libs/1_44_0/doc/html/boost_propertytree/parsers.html#boost_propertytree.parsers.xml_parser" rel="nofollow">http://www.boost.org/doc/libs/1_44_0/doc/html/boost_propertytree/parsers.html#boost_propertytree.parsers.xml_parser</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1952997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1952997</guid><dc:creator><![CDATA[Oberon_0]]></dc:creator><pubDate>Wed, 15 Sep 2010 15:01:04 GMT</pubDate></item><item><title><![CDATA[Reply to C++ TinyXML on Wed, 15 Sep 2010 15:46:54 GMT]]></title><description><![CDATA[<p>Oberon_0 schrieb:</p>
<blockquote>
<p>Ich würde dir statt TinyXml Boost.PropertyTree empfehlen:<br />
<a href="http://www.boost.org/doc/libs/1_44_0/doc/html/property_tree.html" rel="nofollow">http://www.boost.org/doc/libs/1_44_0/doc/html/property_tree.html</a><br />
<a href="http://www.boost.org/doc/libs/1_44_0/doc/html/boost_propertytree/parsers.html#boost_propertytree.parsers.xml_parser" rel="nofollow">http://www.boost.org/doc/libs/1_44_0/doc/html/boost_propertytree/parsers.html#boost_propertytree.parsers.xml_parser</a></p>
</blockquote>
<p>Wieso nicht gleich <a href="http://rapidxml.sourceforge.net/" rel="nofollow">RapidXML</a>?</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1953038</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1953038</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Wed, 15 Sep 2010 15:46:54 GMT</pubDate></item></channel></rss>