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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:36:07+00:00 2026-05-24T22:36:07+00:00

This is an XML example: <ProblemFactory Name=Diagnostic exam Count=1> <Condition ObjectiveID=1 Type=1 CountRanges=2 Range1Decimals=0

  • 0

This is an XML example:

<ProblemFactory Name="Diagnostic exam" Count="1">
    <Condition ObjectiveID="1" Type="1" CountRanges="2" Range1Decimals="0" Range1Min="3" Range1Max="10" Range2Decimals="0" Range2Min="6" Range2Max="10" />
    <Condition ObjectiveID="1" Type="1" CountRanges="2" Range1Decimals="0" Range1Min="6" Range1Max="10" Range2Decimals="0" Range2Min="6" Range2Max="10" />
</ProblemFactory>

And I’m trying to do something like the following:

        XDocument xdoc = XDocument.Load("ProblemFactory.xml");
        var problems = from pf in xdoc.Descendants("Condition")
                       select new
                       {
                           // ObjectiveID property
                           // Type property
                           // Ranges collection property
                       };

Create the ranges collection is my problem. How can I strutured my XML file or query to create the collection? The collection will contain: RangeDecimals, RangeMin, RangeMax.

I’m not sure, but I can Imagine to solve this problem I’ve gotta reestruct my Condition tuple:

<Condition ObjectiveID="1" Type="1" >
    <RangesCollection>
        <Range RangeDecimals="0" RangeMin="3" RangeMax="10" />
        <Range RangeDecimals="0" RangeMin="6" RangeMax="10" />
    </RangesCollection>
</Condition>
  • 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-24T22:36:07+00:00Added an answer on May 24, 2026 at 10:36 pm
    var problems = 
        from condition in xdoc.Descendants("Condition")
        select new {
            ObjectiveID = condition.Attribute("ObjectiveID").Value,
            Type = condition.Attribute("Type").Value,
            Ranges = Enumerable
                .Range(1, (int)condition.Attribute("CountRanges"))
                .Select(i => new {
                    Min = (int)condition.Attribute("Range" + i + "Min"),
                    Max = (int)condition.Attribute("Range" + i + "Max"),
                    Decimals = (int)condition.Attribute("Range" + i + "Decimals"),
                }).ToArray()
        };
    

    With the new format,

    Ranges = condition.Descendants("Range")
        .Select(range => new {
            Min = (int)range.Attribute("RangeMin"),
            Max = (int)range.Attribute("RangeMax"),
            Decimals = (int)range.Attribute("RangeDecimals")
        })
        .ToArray()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this example XML file: <doc> <tag> Hello ! </tag> <tag> My name is
Given this XML: <?xml version=1.0 encoding=utf-8?> <content dataType=XML> <item type=Promotion name=Sample Promotion expires=04/01/2009> <![CDATA[
Hy, I have for example this xml: <books> <book1 name=Cosmic> <attribute value=good/> </book1> </books>
Imagine this XML file (sorry for sick example!!) <DOC> <Test> <Name>1 vs 100 Pre
For example i have this xml. I need to get value of parameter val
This is an example xml from MSDN <?xml version=1.0?> <!-- A fragment of a
For example, In this document < ?xml version=1.0 ? > < SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/
I've got some XML, for example purposes it looks like this: <root> <field1>test</field1> <f2>t2</f2>
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>
Using this xml example: <templateitem itemid=5> <templateitemdata>%ARN%</templateitemdata> </templateitem> <templateitem itemid=6> <templateitemdata></templateitemdata> </templateitem> I am

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.