I've looked at STAN, and its been suggested several times in this thread.
I'm sorry, but, I do not find that to be at all clean, or intuitive. I
find the syntax weird and misleading.
Matt Good wrote:
>On Thu, 2006-05-11 at 23:57 +0000, Sean Jamieson wrote:
>
>
>>ok, Thunderbird screwed up the formatting a bit:
>>
>>in Amara, this would look like:
>>
>>writer = MarkupWriter()
>>writer.startDocuement()
>>writer.startElement( 'people' )
>>for rec in db:
>> writer.startElement( 'person' )
>> writer.simpleElement( 'name', content=rec.get('name') )
>> writer.simpleElement( 'age', content=rec.get('age') )
>> birthday = datetime.fromtimestamp( rec.get( 'birthday' ) )
>> writer.simpleElement( 'birthday', content=birthday.strftime( "%a,
>>%d %b %Y %H:%M:%S EST" ) )|
>> writer.endElement( 'person' )
>>writer.endElement( 'people' )
>>writer.endDocument()
>>
>>
>
>Well, this discussion may be more relevant to the Python XML SIG:
>http://www.python.org/community/sigs/current/xml-sig/
>
>You may also want to take a look Stan, which allows you to generate
>XHTML quite cleanly in Python. Just a little more magic and it's just
>as easy to create arbitrary XML:
>
>from nevow import stan, flat
>import datetime
>
>class TagFactory(object):
> def __getattr__(self, name):
> return stan.Tag(name)
>
>T = TagFactory()
>
>db = [
> dict(name='person1', age=10, birthday=datetime.date(1996, 1, 1)),
> dict(name='person2', age=15, birthday=datetime.date(1991, 5, 21))
>]
>
>person_doc = T.people [[
> T.person [
> T.name [ rec.get('name') ],
> T.age [ rec.get('age') ],
> T.birthday [ rec.get('birthday').strftime('%x') ]
> ] for rec in db
>]]
>
>print flat.flatten(person_doc)
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---