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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:29:53+00:00 2026-06-07T07:29:53+00:00

Let’s say i have a xml file with a tag named which contains the

  • 0

Let’s say i have a xml file with a tag named which contains the number of fields i want to show in my tableView and in another xml file i have the information to be displayed in that tableView.

The question is : Should i create 2 different file in my project (xmlparse1.h and .m + xmlparse2.h and .m) or should i just put all my code in 1 (xmlparse.h + .m) and differenciate which file i am parsing at the moment with a bool or something like that in the code?

I am developing an iphone app on Xcode 4.3 mac os x 10.7.4 if this might change

EDIT: 1st file :

<MenuPrin>
<humidite>82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</humidite>
<tempmoy>
189,124,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700
</tempmoy>
</MenuPrin>

2nd File :

<Instal>
<nbrField>2</nbrField>
</Instal>

So it looks like this. So, since nbrField is 2 I would take the 2 first value from tempMoy and humidite and show them in a tableView.

END OF EDIT

  • 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-07T07:29:55+00:00Added an answer on June 7, 2026 at 7:29 am

    If how you’re parsing is similar in both instances, to add two sets of files that do effectively the same thing would be extremely inefficient and considered bad practice. It makes a lot more sense to create a parser that can handle the two different files than to write two parsers that can only handle a specific file each.

    To more specifically answer your question, I would determine which file you are parsing and behave accordingly, whether you do this with a bool or something else is up to you.

    EDIT: Here is the idea that just popped into my head, so if for whatever reason this wont work for you(Like I said its been a while), or someone has a better idea, I’m all ears. You could still have a set of files(.h and .m) that contain the definition of your parser. Your parser could contain within it a two variables of type Object1 and Object2 which are built in such a way that they resemble the data structure that you need to store what you parse once for your first type of file, and a different definition for your second type of file. This way when parsing once you determine which file it is you are reading, it just changes which of these two objects you write into. There are also plenty of variations for how you could set this up, and I can also think of a few cases for what you might be trying to do where this might not work, but there is the idea regardless.

    If you think that the two sets of files approach is better for the application you are trying to write and makes more sense to you, given what has been discussed in the comments, it isn’t necessarily a bad idea.

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

Sidebar

Related Questions

Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I don't have photoshop, but I want to make pattern files (.pat)
Let's say I have a method in java, which looks up a user in
Let's say I have thousands of users and I want to make the passwords
Let's say I have a text file composed like this ##### typeofthread1 ##### typeofthread2
Let's suppose I have an XML file like this: <?xml version=1.0 encoding=ISO-8859-1?> <MIDIFile> <Event>
Let's say I have a dataset, which can be neatly classified using weka's J48
Let's say I have a drive such as C:\ , and I want to
Let's say I have an Instant Messenger server using SignalR. I want to broadcast
Let's say I want to have some kind of a cache that did something

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.