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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:58:38+00:00 2026-05-30T12:58:38+00:00

I am actually stuck in my current project. I’ve got a XML of the

  • 0

I am actually stuck in my current project.

I’ve got a XML of the following structure:

<ExampleCol>
  <ElementWithAttribute attr="null">ElementWithAttribute</ElementWithAttribute>
  <AnotherCol> 
    <Row attr="row1">Name = 1 </Row>
    <Row attr="row2"> Name = 2 </Row>
  </AnotherCol>
<ExampleCol>

I am not able to change that XML structure.

Currently I am working with those classes:

[XmlRoot]
public class ExampleCol
{
    [XmlElement("ElementWithAttribute")]
    public ElementWithAttribute ewa1 {get;set}

    [XmlElement("AnotherCol")]
    public AnotherCol ac1 {get;set}
}

public class ElementWithAttribute 
{
  [XmlElement("ElementWithAttribute")
  public string Value {get;set;}

  [XmlAttribute("attr")
  public string attr {get;set;}
}

public class AnotherCol
{
  [XmlArray]
  [XmlArrayItem("Row")
  public Row[] RowCollection {get;set;}
}

public Row
{
  [XmlElement("Row")]
  public string Name {get;set;}

  [XmlAttribute("attr")]
  public string Attribute [get;set;]
}

Obviously it cannot deserialize AnotherCol and ElementWithAttribute.

(Obviously, because each class of Row and ElementWithAttribute expects a new element as a child.

But I’m just too dumb to see what changes I need to do to achieve my goals.

Anyone could provide me some hints?

Thanks in advance.

  • 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-30T12:58:39+00:00Added an answer on May 30, 2026 at 12:58 pm

    Here is the code you’ll require to be able to deserialize that set of XML:

    [XmlRoot(ElementName="ExampleCol")]
    public class Test
    {
        [XmlElement("ElementWithAttribute")]
        public ElementWithAttribute Element = new ElementWithAttribute();
    
        [XmlArray(ElementName="AnotherCol")]
        public List<Row> AnotherCol = new List<Row>();
        public Test()
        {
    
        }
    }
    
    public class ElementWithAttribute
    {
        public ElementWithAttribute()
        {
    
        }
        [XmlAttribute]
        public string attr { get; set; }
        [XmlText]
        public string value { get; set; }
    }
    
    public class Row
    {
        public Row()
        {
    
        }
        [XmlAttribute]
        public string attr { get; set; }
        [XmlText]
        public string value { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am actually stuck in merging the result of this two queries: first query:
These are my initial days of working on BackBone.js. I am actually stuck with
Actually I am stuck in middle of some mysql code. Can anyone suggest a
I am upgrading current project from Roo 1.1.5 to 1.2.1. I have noticed there
I'm beginner at Rails, and im actually stuck with apparently a beginner problem. I
I'm about to start a new web project and I'm a bit stuck on
I have a XML file with a structure similar to this: <egh_eval> <eval_set> <eval_id>FLOAT</eval_id>
How can I figure out what is actually causing the following error? The page
Actually i'm on a project for a model many->many. I need to find with
I'm stuck at the Write views that actually do something section. I've modified my

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.