Re: [xml] Namespace normalization/reconciliation

Bruce Miller <bruce miller nist gov> writes:

Rich Salz wrote:
This would seem to be an important cleanup operation, even if it
isn't fast, since you pay for the excess declarations everytime
you use the resulting document.
Look at the C14N (canonicalization) code that is part of the
library.  It
handles things like duplicate xmlns declarations.  (It also does more,
like re-ordering attributes, etc., that you might *not* want, but the
semantic information is not changed.)

Ah, interesting...that spelling hadn't occurred to me :>
And in fact there already _is_ a binding to it in XML::LibXML!!

But it does do _quite_ a bit more than I had really wanted!
It drops the XML declaration & doctype, converts empty elements
and canonicallizes all space (& newlines). Still, it's probably better
than dealing with the declarations.

Thanks a lot for the pointer.

Maybe I'm wrong, but isn't C14N only a method of serializing a
document tree? If yes, then a function that would do the NS cleanup
directly on a live tree would still be very useful.

-- Petr Pajas

Rich Salz                  Chief Security Architect
DataPower Technology
XS40 XML Security Gateway
XML Security Overview

bruce miller nist gov
xml mailing list, project page
xml gnome org


Attachment: pgpHGKab83uaw.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]