[XML-SIG] pydom

Jeff.Johnson@stn.siemens.com Jeff.Johnson@stn.siemens.com
Thu, 8 Oct 1998 13:42:32 -0400


I use pyhtml.py, which uses pydom, to create my HTML elements because it
saves lots of lines of code.  It may not be quite so readable but I don't
think it's that bad.  In fact, I think it's more readable than having to
read the 10 lines of code resulting from using core.py.  I also miss the
ability to specify the attribute names and values in the core
createElement().

Consider the following using pyhtml.py:

     html =
HTML(HEAD(TITLE(self.title)),BODY(list,BACKGROUND=self.background))

Now using core.py (maybe there is a much easier way to do this with
core.py?):

     html = doc.createElement('HTML')
     head = doc.createElement('HEAD')
     title = doc.createElement('TITLE')
     title.appendChild(doc.createTextNode(titleText))
     body = doc.createElement('BODY')
     body.setAttribute('BACKGROUND',background)
     html.appendChild(head)
     html.appendChild(body)
     head.appendChild(title)
     body.appendChild(list)