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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:16:47+00:00 2026-05-29T08:16:47+00:00

I have an xml document in the following format. <?xml version=1.0 encoding=UTF-8 ?> <Rows>

  • 0

I have an xml document in the following format.

<?xml version="1.0" encoding="UTF-8" ?>

<Rows>
<Row>    
    <Field Name='PhysicalLocation'>11;#West</Field>
    <Field Name='ID'>3327</Field>
</Row>
</Rows>

And am attempting to do a linq selection with it.

I have tried the following.

XDocument xmlDoc = XDocument.Load("C:\\manifest.xml");

var query = from item in xmlDoc.Descendants("Rows").Elements()
                    select new { ID = item.Attribute("ID").Value, Value = item.Attribute("PhysicalLocation").Value };

And also

XDocument xmlDoc = XDocument.Load("C:\\manifest.xml");

var query = from item in xmlDoc.Descendants("Rows").Elements()
                    select new { ID = item.Element("ID"), Value = item.Element("PhysicalLocation") };

And in both cases I seem to be coming up short. It is generating the expected amount of rows but the values are not being filled.

Could anyone point me in the right direction? What am I missing?

  • 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-29T08:16:47+00:00Added an answer on May 29, 2026 at 8:16 am

    How about trying a query like this:

    var query =
        from item in xmlDoc.Descendants("Rows").Elements()
        let values = item.Elements("Field")
            .ToDictionary(x => x.Attribute("Name").Value, x => x.Value)
        select new
        {
            ID = values["ID"],
            Value = values["PhysicalLocation"],
        };
    
    • 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 document: <?xml version=1.0 encoding=UTF-8?> <Offices id=0 enabled=false> <office />
I have parsed a basic xml document with the following format <?xml version=1.0?> <data>
I have an XmlDocument object and xml in the format: <?xml version=1.0 encoding=utf-8?> <S
I have the following XML document: <projects> <project> <name>Shockwave</name> <language>Ruby</language> <owner>Brian May</owner> <state>New</state> <startDate>31/10/2008
I have a xml document on the following format and want to transform it
I have an xml document with the following format: <response username=123 customerName=CustomerName siteName=SiteName customerID=123
I have an XML file in the following format: <doc> <id name=X> <type name=A>
I have 50000 XML records like this in the database: <?xml version=1.0 encoding=UTF-8?> <root>
I have the following XML Document being loaded into C# Silverlight: <parent> <son name=Jim>
I have an XML document with the following node: <date>09/01/2012</date> How can i format

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.