[XML-SIG] Cloning and comparing the DOM Document object?

Martin v. Loewis martin@v.loewis.de
04 Jun 2002 18:45:58 +0200

"Mariappan, MaharajanX" <m_mariappanX@trillium.com> writes:

> Can i clone the Doument object and compare one Doument object with other
> Document object?

You could try copy.deepcopy, but you are somewhat at the mercy of the
DOM implementation - this likely won't work.

> Workaround for this is write the current Document object to a temp xml file
> and write the docuent object after change into another xml file
> and do file comparition using any other python file comparing module. But I
> would like know can do this operation in python object level itself,
> which will avoid the file operation and will be more efficient.

You can easily avoid the file operation by writing to and reading from
a string object.