Read out data from XML-File

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi community.
I know this subject came up before but I didnt found the answer I need to fix my problem.

So here is the scenario:
I need to read out some values from an xml-file. The xml-file is created at the first start of the program.
With the following code i read out the first value in the file:
<pre class="prettyprint" style="font-size:12px public string movieCount(string path)
{
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlElement root = doc.DocumentElement;
XmlNodeList xmlMovieCount = root.GetElementsByTagName(&quot;Movies-Count&quot;);
string movCount = xmlMovieCount[0].InnerText;

return movCount;
}[/code]
This method is one out of many, which are in a dll. In the main program, i call this method by using the following code:
<pre class="prettyprint" style="font-size:12px string [] filme = new string[Convert.ToInt32(videoMusic.movieCount(batpath))];[/code]
As soon as the program reaches this line it brings up an error saying, that the access to the path (the path is %USERPROFILE%/Video-Tool/Config_and_Player) was denied. The strange thing is, even if i run my program as administrator it still shows me the
same error:<br/>
<br/>
UnauthorizedAccessExeption was panhandled
So, is there any other way to read out data from an xml-file? or is there an error in my program i am just missing?
Hope anyone has an idea :)


View the full article
 

Similar threads

Back
Top