Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:23:32+00:00 2026-06-08T23:23:32+00:00

I want to get a Element from a XML File. But I don’t know

  • 0

I want to get a Element from a XML File. But I don’t know how I get a Element from The XML.

My XML File:

<?xml version="1.0" standalone="yes" ?>
<NewDataSet>
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="resources">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="id" type="xs:string" minOccurs="0" />
                <xs:element name="text" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <resources>
    <id>id_SearchUser</id>         <!--Label lblSearchUser-->
    <text>Benutzer</text>
  </resources>
  <resources>
    <id>id_location</id>           <!--Label lblLocation-->
    <text>Werk</text>
  </resources>
  <resources>
    <id>id_Search</id>             <!--Button Button2-->
    <text>Suchen</text>
  </resources>
  <resources>
    <id>id_User</id>                <!--Label lblUser-->
    <text>Benutzer</text>
  </resources>
  <resources>
    <id>id_eMail</id>               <!-- Label lblEmail-->
    <text>eMail</text>
  </resources>
  <resources>
    <id>id_Firstname</id>           <!--LinkLabel lnkFirstname-->
    <text>Vorname</text>
  </resources>
  <resources>
    <id>id_Lastname</id>           <!--LinkLabel lnkLastname-->
    <text>Nachname</text>
  </resources>
  <resources>
    <id>id_Telephonnumber</id>     <!--Label lblTelephon-->
    <text>Telefon</text>
  </resources>
</NewDataSet>

My Idea:

I get the location of a User. For Example “de” and than I want to call the GetXMLElement Method that give me the Content of a Element.

For Example:

I have a Label in my Application “id_SearchUser” and I want that this text property change to the Content of the …

…

<resources>
    <id>id_SearchUser</id>        
    <text>Benutzer</text>
</resources>

….

and the Text is than Benutzer.

My Method:

public string GetXMLElement()
{
    XmlDocument xmldoc = new XmlDocument();
    xmldoc.Load(Server.MapPath("~/App_Data/de_language.xml"));
    XmlNode node = // ??
    return // node as string
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:23:35+00:00Added an answer on June 8, 2026 at 11:23 pm

    What about this?

    XDocument document = XDocument.Load(Server.MapPath("~/App_Data/de_language.xml"));
    XElement element = document.Root.Elements("resources").FirstOrDefault(e => e.Element("id").Value == "id_SearchUser");
    string text;
    if (element != null)
      text = element.Element("text").Value;
    

    Notice that I used XDocument instead of your XmlDocument, XDocument uses LINQ whereas XmlDocument uses XPATH to get nodes. It’s a matter of preference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get the highest attribute ID from my XML file. My code:
Good day. As i know. There is a root element in XML file. But
I want to create from XML some objects, but when I'm trying I get
i want know if is possible, to get a specific element value of a
I'm new to xml. I'd like to get all the element name from a
I want to read data from a XMl file which is in a predefined
I have an xml file like down below. I want to get pharmacies nodes'
I'm not able to get html from a very simple XML file as below.
I have an XML file with this structure: <?xml version=1.0> <person> <element att1=value1 att2=value2>Anonymous</element>
I'm getting the following XML-element back in an XML file. From this element I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.