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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:24:10+00:00 2026-06-04T16:24:10+00:00

I am trying to return the the attribute values from this XML, which is

  • 0

I am trying to return the the attribute values from this XML, which is a collection of XmlNodes called from a Sharepoint Webmethod.

XML Data

 <Lists xmlns="http://schemas.microsoft.com/sharepoint/soap/">

    <List DocTemplateUrl="" DefaultViewUrl="/Lists/Announcements/AllItems.aspx" MobileDefaultViewUrl="" ID="{E6172717-EB95-4845-B8CB-8161832565C6}" Title="Announcements" Description="Use the Announcements list to post messages on the home page of your site." ImageUrl="/_layouts/images/itann.gif" Name="{E6172717-EB95-4845-B8CB-8161832565C6}" BaseType="0" FeatureId="00bfea71-d1ce-42de-9c63-a44004ce0104" />


    <List DocTemplateUrl="" DefaultViewUrl="/Lists/Calendar/calendar.aspx" MobileDefaultViewUrl="" ID="{C0735477-BE48-4DDF-9D93-3E1F8E993CEC}" Title="Calendar" Description="Use the Calendar list to keep informed of upcoming meetings, deadlines, and other important events." ImageUrl="/_layouts/images/itevent.gif" Name="{C0735477-BE48-4DDF-9D93-3E1F8E993CEC}" BaseType="0" FeatureId="00bfea71-ec85-4903-972d-ebe475780106" />

///... Several more like this
    </Lists>

I have been following a few different guides, just been going through like this one on DiC, and I’ve managed to get the examples to work.

 public List<Dictionary<string, XmlAttribute>> GetListData(XmlNode collection)
    {            
        #region Test
    string nodeInput = Convert.ToString(collection.OuterXml);

    TextReader sr = new StringReader(nodeInput);

                 //from <List> node, decendant of <Lists>
    var lists = (from list in XElement.Load(sr).Descendants("List")
                 //where the baseType element value equals 0
                 where int.Parse(list.Element("BaseType").Value) == 0
                 //Output the titles values to a list
                 select list.Element("Title").Value).ToList();
     }

    #endregion

I’ve been trying to adapt a few of the examples to my data to get more of an idea how it works, but this query has not returned any results unlike I expected. I’ve written besides each line in a comment what I thought the command was doing, could someone illuminate my mistake?


Solution

Very easy to find once I knew namespace was the issue.

http://msdn.microsoft.com/en-us/library/bb669152.aspx
C# unlike VB requires the namespace even when the nodes aren’t prefixed by it.

So I needed an XNamespace

    XNamespace nameSpace = "http://schemas.microsoft.com/sharepoint/soap/";
    XElement node = XElement.Parse(nodeInput);

    var lists = from list in node.Descendants(nameSpace + "List")
                select list;
    foreach (var list in lists)
    {
        var doc = list.Document;
    }
  • 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-04T16:24:11+00:00Added an answer on June 4, 2026 at 4:24 pm

    Solution

    Very easy to find once I knew namespace was the issue.

    http://msdn.microsoft.com/en-us/library/bb669152.aspx
    C# unlike VB requires the namespace even when the nodes aren’t prefixed by it.

    So I needed an XNamespace

        XNamespace nameSpace = "http://schemas.microsoft.com/sharepoint/soap/";
        XElement node = XElement.Parse(nodeInput);
    
        var lists = from list in node.Descendants(nameSpace + "List")
                    select list;
        foreach (var list in lists)
        {
            var doc = list.Document;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to return a collection which may potentially have null date
I'm trying to return to the second <link> element in the XML from Flickr.
i'm trying to create an application with Windows Phone 7, which displays data from
I'm trying to teach-myself how to serialize/deserialize to/from XML using the attribute-based serializer. I've
I'm trying to extract some data from XML using Linq to XML, and I
I am trying to get an attribute value from an XML file, but my
I am trying to bind the data from linq xml in isolated storage. The
I am trying to return xml that has a specific attribute in sql. The
I'm trying to get values from xml, and I have problem with empty value.
I am trying to return a computed element with a computed attribute. I have

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.