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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:49:38+00:00 2026-06-10T15:49:38+00:00

I want to try and return an object from an XML reader that I

  • 0

I want to try and return an object from an XML reader that I wrote to process a file that will have a partially unknown structure.

Here is a sample of the XML.

<xml>
  <strings>
    <Home>
      <Index>
        <PreWrapper>
          <Left>
            <Title>Blah</Title>
            <Body>Lorem ipsum dolor sit amet, consec tetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit</Body>
            <LinkText>read more</LinkText>
            <LinkUrl>#</LinkUrl>
          </Left>
          <Center>
            <Title>Exploit your ideas</Title>
            <Body>Lorem ipsum dolor sit amet, consec tetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit</Body>
            <LinkText>read more</LinkText>
            <LinkUrl>#</LinkUrl>
          </Center>
          <Right>
            <Title>Grow your business</Title>
            <Body>Lorem ipsum dolor sit amet, consec tetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit</Body>
            <LinkText>read more</LinkText>
            <LinkUrl>#</LinkUrl>
          </Right>
        </PreWrapper>
      </Index>
    </Home>
  </strings>
  <config>
    <Home>
      <Index>
        <ShowPreWrapper>True</ShowPreWrapper>
      </Index>
    </Home>
  </config>
</xml>

I want to be able to just call with my reader

var left = reader.GetObject("xml/strings/Home/Index/PreWrapper/Left");

and I want it to return an anonymous object (or a dynamic object, but I don’t know much about those) that looks like

left.Title
left.Body
left.LinkText
left.LinkUrl

or

var xml = reader.GetObjcet("xml");

and be able to dive right into it like

xml.strings.Home.Index....

but I just cannot figure out how to create this object.
Is this even possible?

  • 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-10T15:49:40+00:00Added an answer on June 10, 2026 at 3:49 pm

    I think that you could approximate this using the ExpandoObject class, but it is quite likely that there are better ways to do it (like using a more loosely typed language, using dictionaries, etc.)

    There is certainly nothing built in to the .NET BCL to do this.

    EDIT: I found this recently, and it probably applies in this situation: ElasticObject.

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

Sidebar

Related Questions

I currently have MVS2008 and I want to try the 2010 version hoping that
I have a function that is supposed to read from a file into a
I'm having trouble deserializing my XML file from a MemoryStream. I have a generated
I have an ASMX webservice with a number of methods which will return XML.
This is my code snippet.I want to return 2D Object type array from the
I wrote a custom XML reader because I needed something that would not read
I have a SQL Statement that works as I want. select COUNT(*), MIN(emailed_to)from email.email_archive
I want to try out Joda Time with Play Framework 2.0. So I have
I have built a site using php and want to try keep it one
I want to return a sngle object usig a guid (its not the primary

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.