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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:28:18+00:00 2026-05-13T11:28:18+00:00

I have a following XML (part of a .rdl report): <Report xmlns:rd=http://schemas.microsoft.com/SQLServer/reporting/reportdesigner xmlns=http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition> <DataSources>

  • 0

I have a following XML (part of a .rdl report):

<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
  <DataSources>
    <DataSource Name="TMSSharepointDataSource">
      <DataSourceReference>TMSSharepointDataSource</DataSourceReference>
      <rd:DataSourceID>f06ffa33-238f-4d83-adfe-1eaa8df96e90</rd:DataSourceID>
    </DataSource>
  </DataSources>
</Report>

I try to parse and read it using following code:

byte[] fileContent = File.ReadAllBytes(@"path");
            UTF8Encoding unicode = new UTF8Encoding();
            string stringContent = unicode.GetString(fileContent);

            XDocument xml = XDocument.Parse(stringContent);
            XElement dsNode = xml.Root.Element("DataSources");

I can’t figure out why is dsNode always null?

  • 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-13T11:28:18+00:00Added an answer on May 13, 2026 at 11:28 am

    It’s a namespace issue… you need to specify the namespace for the DataSources element. Fortunately, LINQ to XML makes this really easy:

    XNamespace ns = "http://schemas.microsoft.com/sqlserver/" + 
            "reporting/2008/01/reportdefinition";
    XElement dsNode = xml.Root.Element(ns + "DataSources");
    

    Note the xmlns="http://..." part of the root element, which means that element and all elements below it which don’t have an explicit namespace inherit that namespace.

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

Sidebar

Related Questions

I have the following XML layout for a ListActivity. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have the following xml object representing a ImageButton <?xml version=1.0 encoding=utf-8?> <ImageButton xmlns:android=http://schemas.android.com/apk/res/android
I have the following the layout file <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:app=http://schemas.android.com/apk/res/com.company android:layout_width=fill_parent
I have the following simple XSL style sheet: <?xml version=1.0 encoding=windows-1252?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns=http://www.w3.org/1999/xhtml
I have the following XML part which schema I can't change. NUMBER, REGION, MENTION,
I have C# Program to Generate RDL File For whitch Show report in Reporting
I have the following XML that uses the name Part in multiple locations. I
I have the following XML: <InterSection criteria=Microsoft-ASP>value</Intersection> <InterSection criteria=Microsoft-MVC>value</Intersection> <InterSection criteria=HP-MVC>value</Intersection> I need to
I have following part of xml file. <UN N=@U1> <DT N=24/06/2011> <PN N=@P1> <TM
I have the following code: <html xmlns=http://www.w3.org/1999/xhtml xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd xml:lang=en lang=en> <body> <wicket:panel> <div wicket:id=serviceListContainer>

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.