[XML-SIG] no 'writexml' when building a domTree from ext.Sax2

Mike Brown mike at skew.org
Wed Jul 28 07:40:16 CEST 2004


Andrew Clover wrote:
> There is no standard interface for serialising a document(*) so the 
> implementations have different ways of doing it. With 4DOM, instead of 
> writexml/toxml you get a separate serialiser object, eg:
> 
>    from xml.dom.ext.Printer import PrintVisitor
>    PrintVisitor(sys.stdout, 'utf-8').visit(document)
> 
> * - well, other than the new DOM Level 3 LS standard, which neither
>      minidom nor 4DOM yet support. (Insert customary pxdom plug here.)

...and the requisite 4Suite plug:

    from Ft.Xml.Domlette import Print
    Print(document, stream=sys.stdout, encoding='utf-8')

While we usually only support Domlette in 4Suite, the Domlette serializer is 
actually capable of handling minidom and 4DOM documents, as well. The Domlette 
serializer is much like 4DOM's, but improved a bit (OK, improved a _lot_). We 
do defer to DOM L3 LS where it makes sense to do so, IIRC.

-Mike


More information about the XML-SIG mailing list