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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:11:34+00:00 2026-05-27T04:11:34+00:00

I am working on an application in which, i have to read XML files

  • 0

I am working on an application in which, i have to read XML files that have a different set of nodes each time, although only a certain number of nodes appear in all the files, the combination in which they appear keep on changing, the XML files are generated by another system which i cannot control, I am looking into Linq to XML and XML serialization, but i guess serialization is not a choice since it needs pre-built classes to create objects.

Example XML data

<Employee>
  <PersonalInfo>
    <FirstName>Vamsi</FirstName>
    <LastName>Krishna</LastName>
  </PersonalInfo>
  <EmploymentInfo>
    <Department>
      <Id>101</Id>
      <Position>SD</Position>
    <Department>
  <EmploymentInfo>
</Employee>

Another Format

<Employee>
  <PersonalInfo>
    <FirstName>Vamsi</FirstName>
    <LastName>Krishna</LastName>
  </PersonalInfo>      
</Employee>

You can observe that EmploymentInfo node is completely missing in the second example, there are many number of combinations in which the XML data can be presented to the application, I have to read the XML file validate it insert into an SQL Server database through my C# code.

  • 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-27T04:11:35+00:00Added an answer on May 27, 2026 at 4:11 am

    I’d say it depends.

    If you just want to communicate with another system in a strongly-typed way, and you can expect the XML schemas to not be changing very frequently, you might be OK with XML serialization. Just encapsulate the deserialization into a separate component and write different versions of them (yes, you’ll need to be able to determine the schema version that is currently used). I mean, each version would have it’s own set of classes that are targeted by the serializer.

    But if you really cannot infer a system out of the schemas used by the external app and need some intelligent parser, you’d better use XPath or Linq to XML or some other XML-level APIs to manually handle the XML-s.

    BTW, both of your samples are pretty easy for the XMLSerializer. In the second case it will just set EmploymentInfo to null.

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

Sidebar

Related Questions

I'm working in an iOS application which uses libXML2 to read XML retrieved from
I have been working on an application which allows the user to make a
I have developed a simple location aware iPhone application which is functionally working very
I'm working on an application so i have write an dll which contain a
I'm working on a project which will end up have a lot of application
I have created a Web Application in asp.net 2.0. which is working fine on
I'm currently working on an oophp application. I have a site class which will
I am working on an application which starts as a service but only if
I'm working on the exception handling layer for my application. I have read few
I have a working application which gets the GPS Long/Lat of from a BlackBerry

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.