<?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[Probleme mit XML]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich habe hier ein grösseres Projekt am laufen, habe das ganze jetzt mal bei mir zuhause installiert und musste feststellen, dass alles läuft ausser das lesen eines XML Files.</p>
<p>Hier ist der Code:</p>
<pre><code class="language-cpp">bool CReadExternFiles::openXMLFile()
{
	m_strXMLFileName  = _T(&quot;modell.xml&quot;);

	CString strTemp   = m_strXMLFilePath + m_strXMLFileName;
	m_bstrXMLFileName = strTemp.AllocSysString();

    if (!FileExists(_T(&quot;strXMLFileName  &quot;))) StopBox(_T(&quot;file existiert nicht!&quot;));

	// call the IXMLDOMDocumentPtr's load function to load the XML document
	variant_t vResult;
	vResult = m_plDomDocument-&gt;load(m_bstrXMLFileName);
	if (((bool)vResult) == TRUE) // success!
	{
		// now that the document is loaded, we need to initialize the root pointer
		m_pDocRoot = m_plDomDocument-&gt;documentElement;
		m_pTempDocRoot = m_pDocRoot;

		//TestAusgabe
		//AfxMessageBox(m_plDomDocument-&gt;xml);
		return TRUE;
	}

	else
	{
		return FALSE;
	}
}
</code></pre>
<p>Klar ist, das Files existiert! Aber die Funktion liefert mir immer ein False zurück. vResult ist FALSE!</p>
<p>Das XML wurde aber korrekt initialisiert soviel ich das erkennen kann:</p>
<pre><code class="language-cpp">void CReadExternFiles::init()
{

	//Initialisierung vom OLE Support
	AfxEnableControlContainer();
	::AfxOleInit();

	if(g_bCoInit == FALSE)
	{
		//COM Initialisierung
		::CoInitialize(NULL);
		g_bCoInit = TRUE;
	}

	HRESULT hr = m_plDomDocument.CreateInstance(CLSID_DOMDocument);
	if (FAILED(hr))
	{
	 _com_error er(hr);
	 AfxMessageBox(er.ErrorMessage());
	}

	//Öffnen des XML File
	openXMLFile();
}
</code></pre>
<p>Im Header File ist auch die DLL (ist im windows/system32) importiert:</p>
<pre><code class="language-cpp">#import &lt;msxml.dll&gt; named_guids
using namespace MSXML;
</code></pre>
<p>Ich denke wenn ich keine XML Unterstützung hätte, dann würde die init Funktion fehlschlagen aber das tut sie nicht. Nun frage ich mich wieso er mir das xml file nicht öffnen kann? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/66650/probleme-mit-xml</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 22:57:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/66650.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 01 Mar 2004 13:03:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit XML on Mon, 01 Mar 2004 13:03:48 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich habe hier ein grösseres Projekt am laufen, habe das ganze jetzt mal bei mir zuhause installiert und musste feststellen, dass alles läuft ausser das lesen eines XML Files.</p>
<p>Hier ist der Code:</p>
<pre><code class="language-cpp">bool CReadExternFiles::openXMLFile()
{
	m_strXMLFileName  = _T(&quot;modell.xml&quot;);

	CString strTemp   = m_strXMLFilePath + m_strXMLFileName;
	m_bstrXMLFileName = strTemp.AllocSysString();

    if (!FileExists(_T(&quot;strXMLFileName  &quot;))) StopBox(_T(&quot;file existiert nicht!&quot;));

	// call the IXMLDOMDocumentPtr's load function to load the XML document
	variant_t vResult;
	vResult = m_plDomDocument-&gt;load(m_bstrXMLFileName);
	if (((bool)vResult) == TRUE) // success!
	{
		// now that the document is loaded, we need to initialize the root pointer
		m_pDocRoot = m_plDomDocument-&gt;documentElement;
		m_pTempDocRoot = m_pDocRoot;

		//TestAusgabe
		//AfxMessageBox(m_plDomDocument-&gt;xml);
		return TRUE;
	}

	else
	{
		return FALSE;
	}
}
</code></pre>
<p>Klar ist, das Files existiert! Aber die Funktion liefert mir immer ein False zurück. vResult ist FALSE!</p>
<p>Das XML wurde aber korrekt initialisiert soviel ich das erkennen kann:</p>
<pre><code class="language-cpp">void CReadExternFiles::init()
{

	//Initialisierung vom OLE Support
	AfxEnableControlContainer();
	::AfxOleInit();

	if(g_bCoInit == FALSE)
	{
		//COM Initialisierung
		::CoInitialize(NULL);
		g_bCoInit = TRUE;
	}

	HRESULT hr = m_plDomDocument.CreateInstance(CLSID_DOMDocument);
	if (FAILED(hr))
	{
	 _com_error er(hr);
	 AfxMessageBox(er.ErrorMessage());
	}

	//Öffnen des XML File
	openXMLFile();
}
</code></pre>
<p>Im Header File ist auch die DLL (ist im windows/system32) importiert:</p>
<pre><code class="language-cpp">#import &lt;msxml.dll&gt; named_guids
using namespace MSXML;
</code></pre>
<p>Ich denke wenn ich keine XML Unterstützung hätte, dann würde die init Funktion fehlschlagen aber das tut sie nicht. Nun frage ich mich wieso er mir das xml file nicht öffnen kann? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/470751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/470751</guid><dc:creator><![CDATA[bsash]]></dc:creator><pubDate>Mon, 01 Mar 2004 13:03:48 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit XML on Mon, 01 Mar 2004 15:42:34 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if (((bool)vResult) == TRUE)
</code></pre>
<p>Dieses Typecast dürfte schief gehen: ein Variant erwartet 0xFFFF für &quot;true&quot;, das Typecast ergibt aber bei &quot;true&quot; eine 1</p>
]]></description><link>https://www.c-plusplus.net/forum/post/470945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/470945</guid><dc:creator><![CDATA[CodeWalker]]></dc:creator><pubDate>Mon, 01 Mar 2004 15:42:34 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit XML on Mon, 01 Mar 2004 17:35:00 GMT]]></title><description><![CDATA[<p>CodeWalker schrieb:</p>
<blockquote>
<pre><code class="language-cpp">if (((bool)vResult) == TRUE)
</code></pre>
<p>Dieses Typecast dürfte schief gehen: ein Variant erwartet 0xFFFF für &quot;true&quot;, das Typecast ergibt aber bei &quot;true&quot; eine 1</p>
</blockquote>
<p>Wieso funktioniert es dann auf dem einen PC und auf dem andern nicht? Habe geschaut was da zurückkommt, bei meinem PC zuhause ist es ein {0 VT_I2} und das heisst, dass der Aufruf nicht erfolgreich war... die Frage ist, wo läuft was schief?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/471022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/471022</guid><dc:creator><![CDATA[bsash]]></dc:creator><pubDate>Mon, 01 Mar 2004 17:35:00 GMT</pubDate></item></channel></rss>