[XML-SIG] Extended DOM interface proposal.
Fred L. Drake
Fred L. Drake, Jr." <email@example.com
Mon, 23 Nov 1998 10:08:42 -0500 (EST)
The toxml() method in the DOM implementation is convenient, but not
always what's needed. There are two specific problems: it creates a
string in memory with the entire document representation, and it can
only produce the XML form of the document.
I'd also like to be able to generate an ESIS stream or SGML from the
DOM, and I don't need the entire representation to be in memory.
I propose the addition of three methods; these could be functions in
a utility module just as easily. Each method should accept a
file-like object that supports at least the write() method. The
def write_esis(self, file):
"""Write an ESIS stream on file."""
def write_sgml(self, file, knownempties=):
"""Write an SGML instance on file. `knownempties' should
be a list of GIs of element types declared to be empty."""
def write_xml(self, file):
"""Write an XML instance on file."""
Does anyone have any opinions as to whether these should be methods
or utility functions? As I think about it, using functions may make
more sense, esp. since different functions may be needed for different
Fred L. Drake, Jr. <firstname.lastname@example.org>
Corporation for National Research Initiatives
1895 Preston White Dr. Reston, VA 20191