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

  • Home
  • SEARCH
  • 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 8533171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:53:54+00:00 2026-06-11T09:53:54+00:00

This is driving me a little crazy. I am pulling an XML string from

  • 0

This is driving me a little crazy. I am pulling an XML string from a database column and successfully creating an XDocument using XDocument.Parse. I’ve used linq to xml before to query xml trees but for some reason on this everything I am doing is returning null. Is it something to do with the namespace?

Here is a sampling of the text visualizer for my XDocument object:

// removed XML for privacy reasons

An example of the query I am trying:

    XElement algorithmId = (from algoId in reportLogXml.Descendants(ALGORITHM_ID)
                            select algoId).FirstOrDefault();

I am using a constant for the string value and I have quadruple checked that the spelling matches as well as trying several different elements that are clearly in the document but they all return null. What am I doing wrong here?

  • 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-11T09:53:56+00:00Added an answer on June 11, 2026 at 9:53 am

    Yes, it probably has to do with the namespace but also the <AlgorithmId> element has no descendants.

    You can fix the ns problem like this:

    //untested
    XNameSpace ns0 = "http://schemas.datacontract.org/2004/07/Adapters.Adapter";
    var ns1 = reportLogXml.Root.GetDefaultNamespace();    
    
    // check: ns0 and ns1 should be equal here
    
    ... in reportLogXml.Descendants(ns1 + ALGORITHM_ID)
    

    Note that this is a special + operator, follow the format exactly.

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

Sidebar

Related Questions

This is driving me crazy. I am creating a splitview app on iPad. I
This is driving me crazy and must be simple. Basically, I've got a little
This is driving me a little crazy because it seems like a fairly straight
I have a bunch of strings in my database like this: driving home from
This is driving me crazy... With this simple code I keep getting file not
This is driving me crazy. I have a PHP script that gets some data
this is driving me crazy. I think my website is infected by some sort
This is driving me crazy. I read the Sun's tutorial regarding the creation of
This is driving me crazy , I just keep getting the message error nothing
This one is driving me a little batty and my eyes are glossing over.

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.