June 2000
Intermediate to advanced
556 pages
8h 45m
English
Here is a utility that allows PYX notation to act as a data source for DOM.
CD-ROM reference=11020.txt """ DOM builder from PYX notation source """ from string import * from StringIO import StringIO from xml.dom.builder import Builder class pyxBuilder(Builder): def __init__(self): Builder.__init__(self) def decode(self,s): # Convert PYX escaped newlines to real newlines. return join (split (s,r"\n"),"\n") def feed(self, data): self.feedpyx(StringIO(data)) def feedpyx(self, pyxStream): pyx = pyxStream.readline() while pyx != "": if pyx[0] == "(": elementname = pyx[1:-1] pyx = pyxStream.readline() dict={} while pyx[0] == "A": [name,value] = split(pyx[1:-1], " ", 1) dict[name] = self.decode(value) pyx = pyxStream.readline() ...Read now
Unlock full access