Le samedi 22 avril 2006 à 16:17 +0100, Guido van Rossum a écrit :
> Groovy has a different approach that doesn't blend the two syntaxes,
> but rather gives you more native syntax for constructing DOM trees (or
> event streams; it wasn't clear from the description I saw today). That
> makes perhaps more sense; it avoids the lexical ambiguities and a
> parentheses-based syntax is easier to type than XML. Maybe this
> example (which I am making up) suffices:
> 
> frag1 = element["some content"]
> 
> frag2 = element["some content",
>                              child(attribute='value')["spam & egg"]]

You might want to take a look at CDuce.
It is a functional language dedicated to transformation of XML
documents. It has a powerful typing system (including structural pattern
matching), and also features a clever syntax for representing XML
fragments in-code.

Here is a simplified example from the tutorial :

let parents : ParentBook =
<parentbook>[
  <person gender="F">[
    <name>"Clara"
    <children>[
      <person gender="M">[
        <name>"Pål André"
        <children>[]
      ]
    ]
    <email>"[EMAIL PROTECTED]"
    <tel>"314-1592654"
  ] 
  <person gender="M">[
    <name>"Bob"
    <tel kind="work">"271828"
    <tel kind="home">"66260"
  ] 
] 

http://www.cduce.org/tutorial.html

Regards

Antoine.


_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to