I was thinking about integrating cElementTree in the future, but to make a quick proof of concept, I just have my toxml() manually assembling a string, using generators.
currently, XMLValue and it's subclasses are optional, with a 'required' bool keyword argument to __init__, also an XMLNodeList can have 0 items (and therefore not appear) I could add another magic attribute parsed from XMLAttrs, like _tagname, called _required ... but generally if a tag has child tags, its going to be used. I've seen hypy before, some months ago, it's yet another template language; It is an interesting idea though. Sean Jorge Vargas wrote: > On 4/28/06, *Sean Jamieson* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Sorry for bringing this old topic up, but I was just playing with > ElementTree yesterday and I made a link to this > I believe your model can be implemented on top of ElementTree, to give > it a more friendly interface. > > class RSS2( XMLModel ): > class XMLAttrs: > _tagname = 'rss' > version = '2.0' > > class channel( XMLNode ): > title = XMLString() > description = XMLString() > link = XMLString() > lastBuildDate = XMLDate( format = "%a, %d %b %Y %H:%M:%S > EST" ) > generator = XMLString() > docs = XMLString() > > class item( XMLNodeList ): > title = XMLString() > link = XMLString() > description = XMLString() > category = XMLList( type = XMLString() ) > pubDate = XMLDate( format = "%a, %d %b %Y %H:%M:%S EST" ) > > > Based on your example > all the helper classes extend the Element > even XMLModel is an extension to the Element. > > So all that needs to be done is a render function that will take your > class and do some calls to SubElement > > One question, how will you manage optional elements in the template? > > how is that? > > on the other hand I remenber looking at > http://manatlan.online.fr/hypy.php > <http://manatlan.online.fr/hypy.php> it's something similar but based > on indentation no classes. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

