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!

    D Offline
    D Offline
    Dy
    wrote on last edited by
    #4

    As ever, it depends on the job in hand, there's no 'one size fits all' option with this sort of thing.

    Wong Shao Voon wrote:

    my users may read the XML project files and inadvertently edit values

    I make it a personal rule to always validate input, regardless of where it's from, for this very reason. If data is stored in a file, it can be changed outside of your control - *always* validate it!


    - Dy

    M 1 Reply Last reply
    0
    • P Paul Watson

      The kind of users who would go fiddling around in XML config. files either know what they are doing, make backups or have no right to complain when something goes wrong. I find it hard to believe someone could inadvertently edit an XML config file. Its not like you stored it on the desktop and named it "todolist.txt" Right? And the benefits of having it readable and editable on the client-side are numerous. So, text-based (XML, CSV, Java style, JSON etc.) would be my choice.

      regards, Paul Watson Ireland & South Africa

      Shog9 wrote:

      And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #5

      Amen to that - they mess with it, it's on their heads.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • D Dy

        As ever, it depends on the job in hand, there's no 'one size fits all' option with this sort of thing.

        Wong Shao Voon wrote:

        my users may read the XML project files and inadvertently edit values

        I make it a personal rule to always validate input, regardless of where it's from, for this very reason. If data is stored in a file, it can be changed outside of your control - *always* validate it!


        - Dy

        M Offline
        M Offline
        Muhadeeb99
        wrote on last edited by
        #6

        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

        P 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!

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #7

          XML. Like others have said, if the users screw with it, it's their problem.


          Software Zen: delete this;

          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!

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #8

            Binary XML!

            image processing toolkits | batch image processing | blogging

            J P E 3 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!

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

              You can use XML, but the file extension could be something other than .xml This allows you to have highly-readable XML, but the user would have to jump through extra hoops to open it and edit the data.

              :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)

              P 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

                P Offline
                P Offline
                Paul Watson
                wrote on last edited by
                #10

                KISS. Choose a format that fits the problem. Don't try and do both. You'll end up with more code to test and support. Multiple points of breakdown.

                regards, Paul Watson Ireland & South Africa

                Shog9 wrote:

                And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                1 Reply Last reply
                0
                • J Josh Smith

                  You can use XML, but the file extension could be something other than .xml This allows you to have highly-readable XML, but the user would have to jump through extra hoops to open it and edit the data.

                  :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)

                  P Offline
                  P Offline
                  Paul Watson
                  wrote on last edited by
                  #11

                  .JSCML (Josh Smith Configuration Markup Language.)

                  regards, Paul Watson Ireland & South Africa

                  Shog9 wrote:

                  And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                  J 1 Reply Last reply
                  0
                  • P Paul Watson

                    .JSCML (Josh Smith Configuration Markup Language.)

                    regards, Paul Watson Ireland & South Africa

                    Shog9 wrote:

                    And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

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

                    .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 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!

                      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
                                          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