Alternatives to XML?

alister alister.ware at ntlworld.com
Wed Aug 24 11:21:30 EDT 2016


On Wed, 24 Aug 2016 16:58:54 +0200, Frank Millman wrote:

> Hi all
> 
> I have mentioned in the past that I use XML for storing certain
> structures 'off-line', and I got a number of comments urging me to use
> JSON or YAML instead.
> 
> In fact XML has been working very well for me, but I am looking into
> alternatives simply because of the issue of using '>' and '<' in
> attributes.
> I can convert them to '>' and '<', but that imposes a cost in
> terms of readability.
> 

are these files expected to be read/written by a human being or are they 
for your application to save & restore its settings?

if the former then you probably need to choose a specification/format 
that was designed to be human readable form the start (such as the 
old .ini format)

if it is primarily for your app then you need a format that efficiently & 
accurately saves the data you require, readability is a secondary (but 
still desirable) requirement for debugging & the rare case where a manual 
change is req.

XLM is bulky with lots of redundant information & still not readily 
readable without extra tools.
Json is quite terse but I find it quite readable & is well suited for 
saving most data structures
pickle can save the data efficiently but is certainly not readable


-- 
Even a blind pig stumbles upon a few acorns.



More information about the Python-list mailing list