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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:50:34+00:00 2026-05-13T20:50:34+00:00

If I am dealing with several standard xml formats what would be the best

  • 0

If I am dealing with several standard xml formats what would be the best practice way of encapsulating them in C# 3.5? I’d like to end up with something similar to the System.ServiceModel.Syndication namespace.

A class that encapsulates the ADF 1.0 XML standard would be one example. It has the main XML root node, 6 child elements, 4 of which are required IIRC, several required and optional elements and attributes further down the tree. I’d like the class to create, at a minimum, the XML for all the required pieces all the way up to a full XML representation. (Make sense).

With LINQ 4 XML and extension classes, etc, etc, there has to be some ideas on quickly generating a class structure for use. Yes? No? 🙂

Am not sure if I gave enough details to get one correct answer but am willing to entertain ideas right now.

TIA

  • 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-13T20:50:34+00:00Added an answer on May 13, 2026 at 8:50 pm

    XML serialization seems a good approach. You could even use xsd.exe to generate the classes automatically…


    EDIT

    Note that the class names generated by the tool are usually not very convenient, so you might want to rename them. You might also want to change arrays of T to List<T>, so that you can easily add items where needed.

    Assuming the class for the root element is named ADF, you can load an ADF document as follows :

    ADF adf = null;
    XmlSerializer xs = new XmlSerializer(typeof(ADF));
    using (XmlReader reader = XmlReader.Create(fileName))
    {
        adf = (ADF)xs.Deserialize(reader);
    }
    

    And to save it :

    ADF adf = ...; // create or modify your document
    ...
    XmlSerializer xs = new XmlSerializer(typeof(ADF));
    using (XmlWriter writer = XmlWriter.Create(fileName))
    {
        xs.Serialize(writer, adf);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble compiling/linking a set of classes, several of them dealing with
I am wondering on the best way of dealing with a problem I have.
I've read several threads dealing with similar issues on here, but I just can't
I have several times ran into the same problem, and I would like to
I am currently dealing with several thousand boxes that i'd like to project onto
So I've been dealing with several APIs recently provided by different software vendors for
I have several classes that extend C and I would need a method that
In my Rails App I've several models dealing with assets (attachments, pictures, logos etc.).
I've been dealing with this before but it seems like the problem came back.
I have several strings which contain numberic values. I'd like to format these strings

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.