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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:21:01+00:00 2026-05-10T21:21:01+00:00

Given this XML … <ListBucketResult xmlns=http://s3.amazonaws.com/doc/2006-03-01/> <Name>public.rpmware.com</Name> <Prefix></Prefix> <Marker></Marker> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated> <Contents> <Key>0.dir</Key> <LastModified>2008-06-25T16:09:49.000Z</LastModified>

  • 0

Given this XML …

<ListBucketResult xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>  <Name>public.rpmware.com</Name>  <Prefix></Prefix>  <Marker></Marker>  <MaxKeys>1000</MaxKeys>  <IsTruncated>false</IsTruncated>  <Contents>   <Key>0.dir</Key>   <LastModified>2008-06-25T16:09:49.000Z</LastModified>   <ETag>'0ba2a466f9dfe225d7ae85277a99a976'</ETag>   <Size>16</Size>   <Owner>    <ID>1234</ID>    <DisplayName>kyle</DisplayName>   </Owner>   <StorageClass>STANDARD</StorageClass>  </Contents>  <!-- repeat similar 100x -->      </ListBucketResult> 

And this C# code:

XDocument doc =  XDocument.Load(xmlReader); var contents = from content in doc.Descendants('Contents') select new {Key = content.Element('Key').Value, ETag = content.Element('ETag').Value};          foreach (var content in contents)         {             Console.WriteLine(content.Key);             Console.WriteLine(content.ETag);         } 

I know the Xdoc is not empty and contains the right XML.

I also implemented some ScottGu code (http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx) as a sanity check and it works exactly as expected.

XDocument doc2 = XDocument.Load(@'http://weblogs.asp.net/scottgu/rss.aspx');         var posts = from items in doc2.Descendants('item') select new { Title = items.Element('title').Value };         foreach (var post in posts)         {             Console.WriteLine(post.Title);         } 
  • 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. 2026-05-10T21:21:01+00:00Added an answer on May 10, 2026 at 9:21 pm

    Xml namespaces:

        XNamespace ns = 'http://s3.amazonaws.com/doc/2006-03-01/';     var contents = from content in doc.Descendants(ns + 'Contents')                    select new { Key = content.Element(ns + 'Key').Value,                        ETag = content.Element(ns + 'ETag').Value }; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given an XML document like this: <!DOCTYPE doc SYSTEM 'http://www.blabla.com/mydoc.dtd'> <author>john</author> <doc> <title>&title;</title> </doc>
Given this xml document: <projects><project><name>sample project</name><location>http://somewhere.com/</location></project></projects> And this linq to xml statement for retrieving
Given this example XML file: <doc> <tag> Hello ! </tag> <tag> My name is
Given a document like this: <html xmlns=http://www.w3.org/1999/xhtml xml:lang=de> <body> ... </body> How can I
Given this xml schema (fragment): <xs:element name=GetIEnumerableResponse> <xs:complexType> <xs:sequence> <xs:element minOccurs=0 name=GetIEnumerableResult nillable=true xmlns:q4=http://schemas.microsoft.com/2003/10/Serialization/Arrays
given this xml as example: <epp:phrases xmlns=http://www.w3.org/1999/xhtml xmlns:epp=http://eprints.org/ep3/phrase xmlns:epc=http://eprints.org/ep3/control> <epp:phrase id=Plugin/Screen/BatchEdit:title>Batch Editing Tool</epp:phrase> <epp:phrase
Given this XML: <?xml version=1.0 encoding=utf-8?> <content dataType=XML> <item type=Promotion name=Sample Promotion expires=04/01/2009> <![CDATA[
given this xml: <root> <list> <!-- foo's comment --> <item name=foo /> <item name=bar
Given an xml structure like this <gesmes:Envelope> <gesmes:subject>Reference rates</gesmes:subject> <gesmes:Sender> <gesmes:name>European Central Bank</gesmes:name> </gesmes:Sender>
Given this XML structure from (http://localhost:3000/route.xml): <objects type=array> <object> <trip0> <departure>20:01</departure> <start>Place a</start> <end>Place

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.