Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. XML or binary format?

XML or binary format?

Scheduled Pinned Locked Moved The Lounge
questionxml
28 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Shao Voon Wong

    Hi guys, I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask? Thanks!

    B Offline
    B Offline
    Bradml
    wrote on last edited by
    #13

    Why not just check the values of the XML file when you import it and make sure noone has messed with it.


    Brad Australian - My Blog Thinking - My Personal [Ad Free] Blog

    T 1 Reply Last reply
    0
    • J Josh Smith

      .MORON (Markup Obviously Retains Originality Now) :)

      :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

      B Offline
      B Offline
      Bradml
      wrote on last edited by
      #14

      .FTLOGDNMTF (For The Love Of God Do Not Modify This File) .WVOC (Warranty Void On Change)


      Brad Australian - My Blog Thinking - My Personal [Ad Free] Blog

      J J 2 Replies Last reply
      0
      • B Bradml

        .FTLOGDNMTF (For The Love Of God Do Not Modify This File) .WVOC (Warranty Void On Change)


        Brad Australian - My Blog Thinking - My Personal [Ad Free] Blog

        J Offline
        J Offline
        Josh Smith
        wrote on last edited by
        #15

        .EDITME :doh:

        :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

        1 Reply Last reply
        0
        • B Bradml

          Why not just check the values of the XML file when you import it and make sure noone has messed with it.


          Brad Australian - My Blog Thinking - My Personal [Ad Free] Blog

          T Offline
          T Offline
          tgrt
          wrote on last edited by
          #16

          Exactly. A file sitting in a folder that the user has access to is obviously outside of the trust boundary and therefore subject to the "all input is evil" idealogy.

          1 Reply Last reply
          0
          • M Muhadeeb99

            Why can't both be used. XML in the initial folder and the binary one in the system folder. Either one is read with caveat for using with choice to implement original.

            All things being equal, tommorrow will never equal today

            J Offline
            J Offline
            Jim Crafton
            wrote on last edited by
            #17

            Muhadeeb99 wrote:

            and the binary one in the system folder

            Installing things in the system folder (I am assuming you mean the root:\Windows or root:\WinNT directory) is really, really bad form unless there are *very* specific reasons for doing so (i.e. device drivers, etc).

            ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

            1 Reply Last reply
            0
            • B Bradml

              .FTLOGDNMTF (For The Love Of God Do Not Modify This File) .WVOC (Warranty Void On Change)


              Brad Australian - My Blog Thinking - My Personal [Ad Free] Blog

              J Offline
              J Offline
              Jim Crafton
              wrote on last edited by
              #18

              Bradml wrote:

              .FTLOGDNMTF (For The Love Of God Do Not Modify This File)

              That would be pretty hilarious to do, and then also register the extension type so that when you click Properties on the file, it shows up with that file description! :)

              ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

              C J 2 Replies Last reply
              0
              • S Shao Voon Wong

                Hi guys, I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask? Thanks!

                R Offline
                R Offline
                Ray Hayes
                wrote on last edited by
                #19

                A bit of both, we use XML files, then once the format becomes stable, we add digital signatures to the file. Obviously we don't give the signing tool out. The signing tool is only for developers and is 100% shared source with the internal save/load mechanism. So, if anyone touches the file - everything breaks in a "You've modified the config file, Exit?" type way, but we can still get the users to open the file and read us out the values (or email sections).

                Regards, Ray

                1 Reply Last reply
                0
                • S Shao Voon Wong

                  Hi guys, I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask? Thanks!

                  T Offline
                  T Offline
                  TClarke
                  wrote on last edited by
                  #20

                  I had a problem similar to this and ended up with an XML file as the main config file (different extension though) and a binary file with the default settings in it. That way if the validation from the XML file failed I could quickly load up the binary defaults and then overwrite the XML file with the values from the binary. I've never heard there was a problem with it.

                  Philosophy: The art of never getting beyond the concept of life.
                  Religion: Morality taking credit for the work of luck.

                  1 Reply Last reply
                  0
                  • S Shao Voon Wong

                    Hi guys, I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask? Thanks!

                    R Offline
                    R Offline
                    Ravi Bhavnani
                    wrote on last edited by
                    #21

                    I recommend XML, since we're talking about config files, and there's value in allowing an end-user to be able to decipher them. But I don't subscribe to the "if the user messes with the file, it's their problem" mantra. I'd build in semantic checks (as much as is practically possible) into the code that loads and uses the data in the file. /ravi

                    This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

                    1 Reply Last reply
                    0
                    • J Jim Crafton

                      Bradml wrote:

                      .FTLOGDNMTF (For The Love Of God Do Not Modify This File)

                      That would be pretty hilarious to do, and then also register the extension type so that when you click Properties on the file, it shows up with that file description! :)

                      ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                      C Offline
                      C Offline
                      CSCarlsson
                      wrote on last edited by
                      #22

                      .MYN (Meddle Ye Not!) .PDF (Programmer Decapitates Fiddlers) Yes I know PDF is already taken :laugh:

                      Jason Brown C# Developer

                      1 Reply Last reply
                      0
                      • C Chris Losinger

                        Binary XML!

                        image processing toolkits | batch image processing | blogging

                        J Offline
                        J Offline
                        Jorgen Sigvardsson
                        wrote on last edited by
                        #23

                        <0/><1/><1/><0/><1/><0/><1/><1/><1/>

                        -- Raaaaaaaaaaaaaaaaaaaaa!

                        1 Reply Last reply
                        0
                        • C Chris Losinger

                          Binary XML!

                          image processing toolkits | batch image processing | blogging

                          P Offline
                          P Offline
                          peterchen
                          wrote on last edited by
                          #24

                          :doh:


                          We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                          My first real C# project | Linkify!|FoldWithUs! | sighist

                          1 Reply Last reply
                          0
                          • S Shao Voon Wong

                            Hi guys, I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask? Thanks!

                            E Offline
                            E Offline
                            El Corazon
                            wrote on last edited by
                            #25

                            Wong Shao Voon wrote:

                            I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask?

                            storing values in binary, or XML, does not negate error checking and default values. If you have a computer crash, and loose half your config file (binary or not) is there any way to save a portion of the config? Also do you ever need to read the data, other than with your application? does anyone else ever have to "look at" the config settings. If your application is the only user, and you can be assured, at no time in the future anyone will EVER need to look at your files, other than your applicaton... perhaps binary is fine. BUT, if you can't make those assurances, and few can since the future is difficult to predict, then XML simply provides a standard method of storing such values so that A) you know what they are without your applicaton (passive view, inspect someone's configuration), B) your customer can interface to the config file (for good or ill, you can't stop this even with binary, only make it more difficult for you and them), and C) open up future capabilities for reading/writing in a standard way. I have done binary files, I have done cfg files (rigid line definition text files), I have done the INI files (my INI library still exists in its oldest version [pre class version] on the net). I never released the latest version because of the move to XML. I have done XML files. Although the initial change to XML was more difficult than any of the above, it does make some things easier.

                            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                            1 Reply Last reply
                            0
                            • C Chris Losinger

                              Binary XML!

                              image processing toolkits | batch image processing | blogging

                              E Offline
                              E Offline
                              El Corazon
                              wrote on last edited by
                              #26

                              Chris Losinger wrote:

                              Binary XML!

                              or XML described binary files! ;P

                              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                              1 Reply Last reply
                              0
                              • J Jim Crafton

                                Bradml wrote:

                                .FTLOGDNMTF (For The Love Of God Do Not Modify This File)

                                That would be pretty hilarious to do, and then also register the extension type so that when you click Properties on the file, it shows up with that file description! :)

                                ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                                J Offline
                                J Offline
                                Josh Smith
                                wrote on last edited by
                                #27

                                Jim Crafton wrote:

                                That would be pretty hilarious to do, and then also register the extension type so that when you click Properties on the file, it shows up with that file description!

                                Or show a picture of a dungeon master holding an axe, titled: "If you change it, I'll kill your family."

                                :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

                                1 Reply Last reply
                                0
                                • S Shao Voon Wong

                                  Hi guys, I have a question for you. For project files of your application, you store them in XML or unreadable binary format? My only concern is that my users may read the XML project files and inadvertently edit values to some incompatible values and cause the application to crash when loading the project files. What is your opinion on this, may I ask? Thanks!

                                  E Offline
                                  E Offline
                                  ednrgc
                                  wrote on last edited by
                                  #28

                                  Years ago, I was programming in a DBase format database language. Basically, it was a simple text file with some index files. Then we were told that Client/Server technologies gave us much more power (which it did). Several years later, they introduced XML, which is nothing more than a text file that contains data. Hmmm, sounds like it's an amazingly bloated version of DBase files. I can't help but wonder how this could have been easier, with less overhead, than XML files. Of course, younger programmers will argue that XML is a relational database with referential integrity. O.K., in some obscure way you can make that argument. But in reality, it is just a text file that can be edited by anyone with notepad.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups