<?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 einträge hinzufügen]]></title><description><![CDATA[<p>Hi Leute<br />
Ich versuch in eine Gruppe einen neuen Eintrag zu machen:<br />
<strong>games.xml</strong></p>
<pre><code class="language-html">&lt;MyGames&gt;
    &lt;Game ID=&quot;1&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
    &lt;Game ID=&quot;2&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
    &lt;Game ID=&quot;3&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
&lt;/MyGames&gt;
</code></pre>
<p>jetzt will ich :</p>
<pre><code class="language-html">&lt;Game ID=&quot;4&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
</code></pre>
<p>in die Gruppe MyGames eintragen mein Problem ist das ich nicht weiß wie ich das machen soll. Weiß jemand von euch wie das unter TinyXml geht?</p>
<p>Edit:<br />
Hier noch der Quelltext:</p>
<pre><code class="language-cpp">int Game::new_game(std::string game_name, std::string game_path)
{
    int id;

    TiXmlDocument doc(&quot;./config/self.conf&quot;);
    TiXmlElement data(&quot;MyGames&quot;);

    doc.LoadFile();

    id = self_list();

    const bool NEW_DATA=(id==-1);

    if(NEW_DATA)
    {
        id=0;
    }

    TiXmlElement name(&quot;Game&quot;);
    name.SetAttribute(&quot;ID&quot;, id+1);
    name.SetAttribute(&quot;NAME&quot;, game_name.c_str());
    name.SetAttribute(&quot;PATH&quot;, game_path.c_str());

    if(NEW_DATA)
    {
        data.InsertEndChild(name);
        doc.InsertEndChild(data);
    }else{
        doc.InsertEndChild(name);
    }

    if(doc.SaveFile())
    {
        return -5;
    }

    return 0;
}
</code></pre>
<p>Gruß,<br />
Nico</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/274391/tinyxml-einträge-hinzufügen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 13:14:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/274391.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Sep 2010 11:09:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TinyXml einträge hinzufügen on Sat, 25 Sep 2010 11:21:44 GMT]]></title><description><![CDATA[<p>Hi Leute<br />
Ich versuch in eine Gruppe einen neuen Eintrag zu machen:<br />
<strong>games.xml</strong></p>
<pre><code class="language-html">&lt;MyGames&gt;
    &lt;Game ID=&quot;1&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
    &lt;Game ID=&quot;2&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
    &lt;Game ID=&quot;3&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
&lt;/MyGames&gt;
</code></pre>
<p>jetzt will ich :</p>
<pre><code class="language-html">&lt;Game ID=&quot;4&quot; NAME=&quot;ABC&quot; PATH=&quot;/abc/abc/acb&quot; /&gt;
</code></pre>
<p>in die Gruppe MyGames eintragen mein Problem ist das ich nicht weiß wie ich das machen soll. Weiß jemand von euch wie das unter TinyXml geht?</p>
<p>Edit:<br />
Hier noch der Quelltext:</p>
<pre><code class="language-cpp">int Game::new_game(std::string game_name, std::string game_path)
{
    int id;

    TiXmlDocument doc(&quot;./config/self.conf&quot;);
    TiXmlElement data(&quot;MyGames&quot;);

    doc.LoadFile();

    id = self_list();

    const bool NEW_DATA=(id==-1);

    if(NEW_DATA)
    {
        id=0;
    }

    TiXmlElement name(&quot;Game&quot;);
    name.SetAttribute(&quot;ID&quot;, id+1);
    name.SetAttribute(&quot;NAME&quot;, game_name.c_str());
    name.SetAttribute(&quot;PATH&quot;, game_path.c_str());

    if(NEW_DATA)
    {
        data.InsertEndChild(name);
        doc.InsertEndChild(data);
    }else{
        doc.InsertEndChild(name);
    }

    if(doc.SaveFile())
    {
        return -5;
    }

    return 0;
}
</code></pre>
<p>Gruß,<br />
Nico</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1957258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1957258</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Sat, 25 Sep 2010 11:21:44 GMT</pubDate></item><item><title><![CDATA[Reply to TinyXml einträge hinzufügen on Sat, 25 Sep 2010 12:05:17 GMT]]></title><description><![CDATA[<p>Dein XML ist Müll. Mach die Attribute zu Tags.<br />
<a href="http://software.ellerton.net/tinyxml.html" rel="nofollow">http://software.ellerton.net/tinyxml.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1957274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1957274</guid><dc:creator><![CDATA[müll.0]]></dc:creator><pubDate>Sat, 25 Sep 2010 12:05:17 GMT</pubDate></item><item><title><![CDATA[Reply to TinyXml einträge hinzufügen on Sat, 25 Sep 2010 12:18:50 GMT]]></title><description><![CDATA[<p>müll.0 schrieb:</p>
<blockquote>
<p>Dein XML ist Müll. Mach die Attribute zu Tags.<br />
<a href="http://software.ellerton.net/tinyxml.html" rel="nofollow">http://software.ellerton.net/tinyxml.html</a></p>
</blockquote>
<p>Dein Link ist Müll. Er erklärt überhaupt nicht was du meinst.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/26836">@topic</a>:<br />
Um die von dir gewünschte Struktur zu erhalten, musst du dir erst das entsprechende Element suchen, dann kannst du in dieses neue Children einhängen. Du erstellst jetzt immer ein neues Element &quot;MyGames&quot;.<br />
Wie das genau mit TinyXml geht, kann ich dir aber nicht sagen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1957277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1957277</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Sat, 25 Sep 2010 12:18:50 GMT</pubDate></item><item><title><![CDATA[Reply to TinyXml einträge hinzufügen on Sat, 25 Sep 2010 12:37:31 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/20104">@l</a>'abra d'or<br />
Ich muss dich verbessern.<br />
Er erstellt nur ein neues Element wenn keine Datei vorhanden ist oder wenn die Datei kein Inhalt hat.</p>
<p>Das sieht man hier dran:</p>
<pre><code class="language-cpp">/*
*
*
*
*/
    id = self_list();

    const bool NEW_DATA=(id==-1);

    if(NEW_DATA)
    {
        id=0;
    }
/*
*
*
*
*/
    if(NEW_DATA)
    {
        data.InsertEndChild(name);
        doc.InsertEndChild(data);
    }else{
        doc.InsertEndChild(name);
    }
</code></pre>
<p>Stimmt ich muss ja noch nach dem Child suchen bin ich blöd <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1957284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1957284</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Sat, 25 Sep 2010 12:37:31 GMT</pubDate></item></channel></rss>