XML vs comma delimited text files

后端 未结 12 2471
面向向阳花
面向向阳花 2021-02-20 08:25

Ok, I\'ve read a couple books on XML and wrote programs to spit it out and what not. But here\'s the question. Both a comma delimited file and a XML file are \"human readable.

12条回答
  •  青春惊慌失措
    2021-02-20 08:57

    Well XML is human readable and human editable. You can look at an XML file and know exactly what it is. A CSV file is human readable but you don't really know what each value means at all.

    For example, if we're storing user accounts, which would you prefer?

    
        ryeguy
        abc123
        3-4-08
        my@email.com
    
    

    OR

    ryeguy,abc123,3-4-08,my@email.com
    

    Of course, this is just an example, but imagine it with 30 fields or so!

    Or worse yet, what if we make subfields?

    
        ryeguy
        abc123
        3-4-08
        my@email.com
        
            
                34
                ....
            
        
    
    

    That would be a pain in the ass to put in a CSV. Soon you'd be making your own querying language.

提交回复
热议问题