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 6377079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:49:32+00:00 2026-05-25T01:49:32+00:00

The data: <sys> <id>SCPUCLK</id> <label>CPU Clock</label> <value>2930</value> </sys> <sys> <id>CPUTEMP</id> <label>CPU Temp</label> <value>39</value> </sys>

  • 0

The data:

<sys>
  <id>SCPUCLK</id>
  <label>CPU Clock</label>
  <value>2930</value>
</sys>
<sys>
  <id>CPUTEMP</id>
  <label>CPU Temp</label>
  <value>39</value>
</sys>

This is the code that I’m using to read the data:

XmlDocument document = new XmlDocument();
document.LoadXml(data);
XmlElement node = document.SelectSingleNode("/sys/value") as XmlElement;
Console.WriteLine("node = " + node);

The issue: Console.WriteLine("node = " + node); doesn’t give me any output besides node: but no actual value like 2930 from the sample above.

Thanks

  • 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-05-25T01:49:32+00:00Added an answer on May 25, 2026 at 1:49 am

    As an alternative to using XmlDocument, you can also use LINQ to XML (which is my preference):

    using System.Xml.Linq;
    
    XDocument xDoc = new XDocument();
    // Parse loads the XDocument with XML from a string
    xDoc = XDocument.Parse(data);
    
    string node = (from x in xDoc.Root.Elements("value")
                   select x.Value).SingleOrDefault();
    
    Console.WriteLine("node = " + node);
    

    Nothing wrong with using XmlDocument, especially for what you’re doing, but you might want to check out LINQ to XML when you get a chance, as I find it a lot easier to work with than XmlDocument.

    If you want to get all the “value” elements, simply remove the SingleOrDefault() from the query, and then you can loop through the result, like this:

    var nodes = from x in xDoc.Root.Elements("value")
               select x.Value;
    
    foreach (var node in nodes)
    {
        Console.WriteLine("node = " + node);
    }
    

    Here’s a site worth checking out:
    LINQ to XML – 5 Minute Overview

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

Sidebar

Related Questions

I know that with Node.js you can stream data. But why doesn't this code
this is my code : import xlrd,sys data = xlrd.open_workbook('a.xls') boss = data.sheets()[3] print
I am trying to read binary data from sys.stdin using Python 2.7 on Windows
Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this
I'm using Client Side templates in my JavaScript. $create(Sys.UI.DataView, { data: data }, null,
If I have data like this DF <- data.frame( date = seq(Sys.Date()-1000, len=1000, by=1
this is the code in question: using (var file = MemoryMappedFile.OpenExisting(AIDA64_SensorValues)) { using (var
I'm new to python and trying to read /sys/devices/system/cpu/cpuX/cpufreq/vdd_levels from a Linux system and
In Python, how do you check if sys.stdin has data or not? I found
This command gets some data from MySQL and then manipulates it. Why is the

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.