Web Analytics Made Easy -
StatCounter How to grab content from xml file using C# - CodingForum

Announcement

Collapse
No announcement yet.

How to grab content from xml file using C#

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to grab content from xml file using C#

    Hi, I am doing this website where I am suppose to LOCALIZE the web contents according to the user's language preference. Labels and buttons can be LOCALIZED easily using ASP.NET's LOCALIZED:LOCALIZEDLITERAL & LOCALIZED:LOCALIZEDBUTTON to grab the content from the respective language resource files.

    But for tooltips, I need to create a function to grab the content in the resource file. The following are the code I found on the web and tried to implement on my website:


    XmlTextReader resourceReader = new XmlTextReader(@"language\\ja-JP\\Resource.xml");

    XmlNode resourceNode1;

    public string readXML()
    {
    XmlDocument resourceXML = new XmlDocument();

    resourceNode1 = resourceXML.SelectSingleNode("//Resource/item[@name = 'login_emailAddOfModerator']");

    return resourceNode1.InnerText.ToString();
    }

    private void LoadToolTips()
    {
    this.txtUserName.ToolTip = readXML();
    }


    The following are the XML code:

    <?xml version="1.0" encoding="utf-8" ?>
    <Resource>
    <item name="login_emailAddOfModerator">調整器のEメールアドレス。</item>
    </Resource>

    The tooltip didnt appear. Please advise me on how to make the code work, thankz
Working...
X