Re: [xml] Namespace normalization/reconciliation



Petr Pajas wrote:

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.

I agree.  In fact, I logged this as an enhancement request a while ago 
-- see http://bugzilla.gnome.org/show_bug.cgi?id=142880

Hopefully, more people being interested in it will increase the chances 
of it getting done sometime.

- Steve



------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for 
the addressee(s) only.  If you have received this message in error or there are any problems, please notify 
the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly 
forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not 
necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and 
any attached files for viruses: Radan Computational will accept no liability for any damage caused by any 
virus transmitted by this email.




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