Alternatives to XML?
Frank Millman
frank at chagford.com
Thu Aug 25 01:33:41 EDT 2016
"Frank Millman" wrote in message news:npkcnf$kq7$1 at blaine.gmane.org...
> 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.
> Can anyone offer an alternative which is closer to my original intention?
Many thanks for the replies. I will respond to them all in one place.
@alister
"are these files expected to be read/written by a human being or are they
for your application to save & restore its settings?"
Good question.
My project is a business/accounting system. It provides a number of tables
and columns pre-defined, but it also allows users to create their own. I
allow them to define business rules to be invoked at various points.
Therefore it must be in a format which is readable/writable by humans, but
executable at runtime by my program.
.ini is an interesting idea - I will look into it
@rob
"You've been staring at that XML too long; you've become familiar with
it. It's just as unreadable as the JSON or the YAML unless you already
know what it says."
Good comment! I am sure you are right. Whichever format I settle on, I will
have to provide some sort of cheat-sheet explaining to non-technical users
what the format is.
Having said that, I do find the XML more readable in the sense that the
attributes are closely linked with their elements. I think it is easier to
explain what <compare src="_param.auto_party_id" op="is_not" tgt="$None"> is
doing than the equivalent in JSON or YAML.
@Marko
I have never heard of S-expressions before, but they look interesting. I
will investigate further.
@Peter/Chris
I don't understand - please explain.
If I store the business rule in Python code, how do I prevent untrusted
users putting malicious code in there? I presume I would have to execute the
code by calling eval(), which we all know is dangerous. Is there another way
of executing it that I am unaware of?
Frank
More information about the Python-list
mailing list