Alternatives to XML?

Marko Rauhamaa marko at pacujo.net
Wed Aug 24 11:12:03 EDT 2016


"Frank Millman" <frank at chagford.com>:
> 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.

JSON is very good.

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

Precise syntax requires escaping. In fact, XML is not good enough at it.
XML is far too much and too little at the same time.

> Here is a simple example -
>
> <case>
>  <compare src="_param.auto_party_id" op="is_not" tgt="$None">
>    <case>
>      <on_insert>
>        <auto_gen args="_param.auto_party_id"/>
>      </on_insert>
>      <not_exists>
>        <literal value="<new>"/>
>      </not_exists>
>    </case>
>  </compare>
> </case>

> Can anyone offer an alternative which is closer to my original intention?

There's S-expressions:

   (case
    (compare #:src "_param.auto_party_id"
             #:op "is_not"
             #:tgt #f
     (case
      #:on-insert (auto-gen "_param.auto_party_id")
      #:not-exists (literal "<new>"))))


Marko



More information about the Python-list mailing list