X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fsp%2Fcons.py;h=0c36458f8af3b99d84a5dc70470a4d05db7484ea;hb=919b8a4ff35da1fce73f238754ef376705c52e18;hp=cb9d451b7984948958058d89dfe73a82ced37ef4;hpb=784495582d53f5b759dd216ddd1268fbe2479bb9;p=wrw.git diff --git a/wrw/sp/cons.py b/wrw/sp/cons.py index cb9d451..0c36458 100644 --- a/wrw/sp/cons.py +++ b/wrw/sp/cons.py @@ -40,7 +40,7 @@ class element(node): return self.__todom__(doc).toxml() class context(object): - charset = sys.getfilesystemencoding() + charset = (sys.getfilesystemencoding() or "ascii") def __init__(self): self.nodeconv = {} @@ -59,6 +59,8 @@ class context(object): raise Exception("No node conversion known for %s objects" % str(type(ob))) def addchild(self, node, child): + if child is None: + return node.children.append(self.nodefrom(child)) def addattr(self, node, k, v): @@ -74,3 +76,9 @@ class constructor(object): def __getattr__(self, name): return self._elcls(self._ns, name, self._ctx) + +class doctype(node): + def __init__(self, rootname, pubid, dtdid): + self.rootname = rootname + self.pubid = pubid + self.dtdid = dtdid