John W. Shipman <[EMAIL PROTECTED]> wrote:

Look under the last chapter, ``Creating a document from scratch.''
I use the constructors such as Document() and Element() in that
minidom version, but now they want me to use the .createElement()
and other factory methods from the Document object.

They always did - it's the DOM standard. Minidom was just less fussy about it a long time ago; you're more likely to get errors about it these days.


I can't instantiate it as a Document object, because then I
would get an <?xml...?> processing instruction at the top,
which is not something I want inside the <body> element of
a web page.

That's not a good reason not to use a Document. An XML serializer *may* allow a Document to be output without the XML declaration (pxdom supports the DOM Level 3 LS parameter 'xml-declaration', for example). Alternatively, just serialise the Document.documentElement or its children instead of the Document object itself.


Previously I was getting around this problem by using a
DocumentFragment object, but such objects in the minidom have an
.ownerDocument attribute set to None.

A DocumentFragment still has to have an owner Document. Minidom DocumentFragments only have a null ownerDocument if you have constructed them wrong, using minidom's own private constructors.


--
Andrew Clover
mailto:[EMAIL PROTECTED]
http://www.doxdesk.com/
_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to