Frank Millman wrote:

> 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 '&gt;' and '&lt;', but that imposes a
> cost in terms of readability.
> 
> 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="&lt;new&gt;"/>
>       </not_exists>
>     </case>
>   </compare>
> </case>
> 
> This is equivalent to the following python code -
> 
> if _param.auto_party_id is not None:
>     if on_insert:
>         value = auto_gen(_param.auto_party_id)
>     elif not_exists:
>         value = '<new>'

I think we have a winner here ;)

> The benefit of serialising it is partly to store it in a database and read
> it in at runtime, and partly to allow non-trusted users to edit it without
> raising security concerns.

If you store what is basically a script as XML or JSON, why is that safer 
than Python or Javascript?



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to