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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:59:21+00:00 2026-06-18T23:59:21+00:00

i have xml file that i need to update each and every time as

  • 0

i have xml file that i need to update each and every time as per new client requirement.
most of the time xml is not proper because of manual updation of xml file.
I am thinking to write a program (web/windows) where proper validation is provided.
and based on the input from ui I will going to create xml file.
below is my sample xml file.

<community>
  <author>xxx xxx</author>
  <communityid>000</communityid>
  <name>name of the community</name>

<addresses>
        <registeredaddress>
          <addressline1>xxx</addressline1>
          <addressline2>xxx</addressline2>
          <addressline3>xxx</addressline3>
          <city>xxx</city>
          <county>xx</county>
          <postcode>0000-000</postcode>
          <country>xxx</country>
        </registeredaddress>
        <tradingaddress>
          <addressline1>xxx</addressline1>
          <addressline2>xxx</addressline2>
          <addressline3>xxx</addressline3>
          <city>xxx</city>
          <county>xx</county>
          <postcode>0000-000</postcode>
          <country>xxx</country>
        </tradingaddress>
      </addresses>


<community>

can any one help me what will be the best approach for this?

  • 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-18T23:59:22+00:00Added an answer on June 18, 2026 at 11:59 pm

    Create following classes to hold your data and validate it:

    public class Community
    {
        public string Author { get; set; }
        public int CommunityId { get; set; }
        public string Name { get; set; }
        [XmlArray]
        [XmlArrayItem(typeof(RegisteredAddress))]
        [XmlArrayItem(typeof(TradingAddress))]
        public List<Address> Addresses { get; set; }
    }
    
    public class Address
    {
        private string _postCode;
    
        public string AddressLine1 { get; set; }
        public string AddressLine2 { get; set; }
        public string AddressLine3 { get; set; }
        public string City { get; set; }
        public string Country { get; set; }
    
        public string PostCode
        {
            get { return _postCode; }
            set {
                // validate post code e.g. with RegEx
                _postCode = value; 
            }
        }
    }
    
    public class RegisteredAddress : Address { }
    public class TradingAddress : Address { }
    

    And serialize that instance of community class to xml:

    Community community = new Community {
        Author = "xxx xxx",
        CommunityId = 0,
        Name = "name of community",
        Addresses = new List<Address> {
            new RegisteredAddress {
                AddressLine1 = "xxx",
                AddressLine2 = "xxx",
                AddressLine3 = "xxx",
                City = "xx",
                Country = "xxxx",
                PostCode = "0000-00"
            },
            new TradingAddress {
                AddressLine1 = "zz",
                AddressLine2 = "xxx"
            }
        }
    };
    
    XmlSerializer serializer = new XmlSerializer(typeof(Community));
    serializer.Serialize(File.Create("file.xml"), community);
    

    I think a little googling will help you to understand how to deserialize community object back from file.

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

Sidebar

Related Questions

I have a dynamic products xml file that i need to load from an
I have an XML file consisting of Name/Value pairs that I need in a
I have an XML file that reads like this <abc> <ab>value</ab> <aa>time</aa> <ac>money</ac> </abc>
I have an XML file that has a number of nodes, each of which
A vendor is supplying a 1MB XML file that updates every minute. I need
I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>
I have an XML file that I'm trying to read from here , and
I have an XML file that is well formed and valid (matched with an
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have an XML file that is very long, but here is a shot

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.