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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:50:16+00:00 2026-05-31T23:50:16+00:00

I have this xml <KitContent> <MsiData> <FileName>file1</FileName> <BaseProductVersion>1.1.0.0</BaseProductVersion> </MsiData> <MsiData> <FileName>file2</FileName> <BaseProductVersion>1.1.0.0</BaseProductVersion> </MsiData> </KitContent>

  • 0

I have this xml

<KitContent>
  <MsiData>
    <FileName>file1</FileName>
    <BaseProductVersion>1.1.0.0</BaseProductVersion>
  </MsiData>
  <MsiData>
    <FileName>file2</FileName>
    <BaseProductVersion>1.1.0.0</BaseProductVersion>
  </MsiData>
</KitContent>

I want to serialize it to a class
how does the class should look like?

public class KitContent
{
    public List<MsiData> ???? { get; set; }

    public KitContent()
    {
        ??? = new List<MsiData>();
    }
}


public class MsiData
{
    public string FileName { get; set; }
    public string BaseProductVersion { get; set; } 
}

}

the ‘???’ i put in the class above is my problem

  • 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-31T23:50:18+00:00Added an answer on May 31, 2026 at 11:50 pm

    I’m not sure of what do you want, but ??? can be any identifier. If you want to parse this xml into C# classes, IMHO best way to do this is by using Xml.Serialization namespace.

    Here is example:

    class Program
        {
            static void Main(string[] args)
            {
                string xml = "<KitContent>" +
                              "<MsiData>" +
                                "<FileName>file1</FileName>" +
                                "<BaseProductVersion>1.1.0.0</BaseProductVersion>" +
                              "</MsiData>" +
                              "<MsiData>" +
                                "<FileName>file2</FileName>" +
                                "<BaseProductVersion>1.1.0.0</BaseProductVersion>" +
                              "</MsiData>" +
                            "</KitContent>";
    
                XmlSerializer serializer = new XmlSerializer(typeof(KitContent));
                KitContent kitContent = (KitContent)serializer.Deserialize(XmlReader.Create(new StringReader(xml)));
    
                Console.WriteLine(kitContent.anyIdentifier[0].FileName);
                Console.WriteLine(kitContent.anyIdentifier[0].OtherName);
                Console.WriteLine(kitContent.anyIdentifier[1].FileName);
                Console.WriteLine(kitContent.anyIdentifier[1].OtherName);
            }
        }
    
        [XmlRoot("KitContent")]
        public class KitContent
        {
            [XmlElement("MsiData")]
            public List<MsiData> anyIdentifier { get; set; }
        }
    
        public class MsiData
        {
            public string FileName { get; set; }
    
            [XmlElement("BaseProductVersion")]
            public string OtherName { get; set; }
        }
    

    If your property name is the same as Element in xml, you don’t need to put attribute on that property.

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

Sidebar

Related Questions

I have this XML content: $XML = <item xmlns='http://...'>Some value</item>; I want to extract
I have this XML file, and I want to deserialize it to an object.
I have this xml node. I want to split the coordinate to latitude and
I have this xml: <pos:getPositionRouter xmlns:pos=positionNS> <positionID> <code>1</code> </positionID> <parameter>?</parameter> </pos:getPositionRouter> and I want
I have this xml file and I want to get some values with Xpath.
I have this xml, I want to check the existence of price node if
I have this XML that I want to be able to pull out the
I have this XML here, and I want to set the max_width for the
I have this XML: <location> <character name=name mask=pap.png X=397 Y=60> <look reaction=False> text1 <answer>text2</answer>
I have this XML file that I have imported into Cocoa and want to

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.