<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>4 Apr 2018 08:53:40 Z</lastBuildDate><pubDate>28 Mar 2018 10:27:14 Z</pubDate><description>I am trying to do some work with xmlDocument.  When I pass the name of xmlDocument as string the code works, but when I pass the name of xmlDocument as variable, the code crashes with runtime error. &#13;
&#13;
I am working with the same XML source file in both cases.&#13;
&#13;
To demonstrate the problem I have isolated the simplest possible example.&#13;
Test 1 finds the element as expected. Test 2 crashes in XMLFind.&#13;
&#13;
[code:wl]&#13;
// TEST 1 -- this works -- xmlDocument as a string&#13;
myDoc is string = fLoadText( sFName)&#13;
XMLDocument("XMLMain", myDoc) &#13;
r = XMLFind ("XMLMain", "TestNumber", XMLElement)&#13;
IF True = r &#13;
	Info ("test1 - FOUND ")&#13;
ELSE&#13;
	Error ("test1 - NOT FOUND " + ErrorInfo())&#13;
END&#13;
&#13;
// TEST 2 -- this DOES NOT work -- xmlDocument as variable&#13;
myXml is xmlDocument&#13;
myXml = XMLOpen(sFName,fromFile) //the document is correctly loaded (the structure checked in debugger)&#13;
r = XMLFind (myXml, "TestNumber", XMLElement) // RUNTIME ERROR: XMLFind function called. Error caused by 1 parameter. An element of 'xmlDocument' type cannot be converted to the 'UNICODE string' type.&#13;
IF True = r &#13;
	Info ("test2 - FOUND ")&#13;
ELSE&#13;
	Error ("test2 - NOT FOUND " + ErrorInfo())&#13;
END&#13;
[/code]&#13;
&#13;
What am I missing ?</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error/read.awp</link><title>Using xmlDocument as parameter causes RUNTIME ERROR</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>vvido</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error-65126/read.awp</comments><pubDate>4 Apr 2018 08:53:40 Z</pubDate><description>Thanks for your reply.&#13;
I have checked the help again and realized that this was no possible.&#13;
&#13;
Unfortunately the library is no…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error-65126/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error-65126/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error/read.awp">Using xmlDocument as parameter causes RUNTIME ERROR</source><title>Re: Using xmlDocument as parameter causes RUNTIME ERROR</title></item><item><author>tim</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error-65121/read.awp</comments><pubDate>3 Apr 2018 17:24:07 Z</pubDate><description>[code:text]&#13;
&lt;Result&gt; = XMLDocument(&lt;Name of XML Document&gt; [, &lt;XML Code&gt; [, &lt;Option&gt;]])&#13;
&#13;
&lt;Name of XML Document&gt;: Character str…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error-65121/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error-65121/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65051-using-xmldocument-parameter-causes-runtime-error/read.awp">Using xmlDocument as parameter causes RUNTIME ERROR</source><title>Re: Using xmlDocument as parameter causes RUNTIME ERROR</title></item></channel></rss>
