[Zope-dev] XMLDocument shortcomings

Melis Gábor gabor.melis@essnet.se
Thu, 18 Nov 1999 18:50:20 +0200


Having retrieved the current code from the CVS I see no difference from my
old version. No matter, it was a useful exercise.

I realize there are problems with the current code:
- Special characters (&,<,>) are not escaped by the toxml() method
- there is no way to specify encoding for toxml or for display purpose in
  general

The first is a trivial issue, but I am not sure how (or where) to solve
the second one. It gets pretty annoying if at the
management interface one types:

<?xml version="1.0" encoding="iso-8859-1"?>
<root>
  öäå
</root>

but after clicking on the Change button gets:

<?xml version="1.0"?>
<root>
  öäå
</root>

As I understand it, the result is UTF-16. In most cases though, I would like
to output it in 'iso-8859-1'.

I think that XMLDocument should remember the encoding used to create the
DOM and use that encoding to produce xml. Perhaps toXML() can take an
encoding parameter and there is a getEncoding() method, too.
So one can write:

mydoc.toXML(encoding=mydoc.getEncoding())

I can imagine making this the default, as well.

What do you guys think?

And what is the policy on bringing new library dependencies? I am thinking
about using more of xml-sig's stuff.

Regards, Gabor