This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aubrey.Barnard
Recipients Aubrey.Barnard
Date 2010-09-17.03:30:35
SpamBayes Score 1.9325672e-07
Marked as misclassified No
Message-id <1284694245.92.0.410723728376.issue9883@psf.upfronthosting.co.za>
In-reply-to
Content
Summary:
Writing a document fragment doesn't work because the 'writexml' method is not implemented.

Problem:
I would like to be able to write out document fragments as XML text, but this functionality is not implemented. Here are the reasons why I think this functionality should be implemented.

1. DOM Level 1 describes a document fragment as a lightweight document. I can write a document as XML text so why not a document fragment?

2. This would be very easy to implement, basically just the child processing loop from Element.writexml:
for node in self.childNodes:
    node.writexml(writer,indent+addindent,addindent,newl)

3. Document fragments are often returned as intermediate results in XML building. The best way I can think of to unit test these results is by writing the document fragment as XML text and comparing to an existing string. (Comparing two document fragments is not guaranteed to work.)

4. Implementing an XML editor on top of minidom would require this functionality, e.g. display a piece of cut XML.

I realize that writing document fragments as XML text is not a common or "core" operation, but it makes sense in the above four cases and perhaps other cases as well. Therefore, to me, implementing this functionality is less a question of "Why?" and more a question of "Why not?"

I will be glad to add any other information as requested.
History
Date User Action Args
2010-09-17 03:30:46Aubrey.Barnardsetrecipients: + Aubrey.Barnard
2010-09-17 03:30:45Aubrey.Barnardsetmessageid: <1284694245.92.0.410723728376.issue9883@psf.upfronthosting.co.za>
2010-09-17 03:30:39Aubrey.Barnardlinkissue9883 messages
2010-09-17 03:30:35Aubrey.Barnardcreate