how to access xml resource file in C# wpf application?
i have made xml file a resource file but i cant access it .

here is a code:

private static string MessageExtract(string tagName) 

 {
   XmlDocument messageTags = new XmlDocument();
   messageTags.Load(@"//resources//Messages.xml");//this dont work 

   XmlElement messageRoot= (XmlElement)messageTags.GetElementsByTagName(tagName)[0];

   return  messageRoot.GetElementsByTagName(AppManager.GetCurrentLanguage())[0].InnerText;

  }

Recommended Answers

All 2 Replies

What's the error you're getting?

One thought though, take a look at http://msdn.microsoft.com/en-us/library/362314fe%28VS.71%29.aspx, specifically the part about @-quoted strings and how they affect escape characters.

Also, when I've loaded files, I've always used say "\\resources\\file.xml" ; that is, backslashes instead of forward slashes. I think that's how path descriptions have to be.

sorry about that..
but i use this "\\resources\\file.xml" ..
While posting i make a mistake ,actually using xml file as resource is my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.