[fpc-devel] XML canonical

Sergei Gorelkin sergei_gorelkin at mail.ru
Fri Aug 28 17:15:05 CEST 2009


Dariusz Mazur wrote:

>> I'd suggest you to find a test suite (some examples are contained 
>> directly in the text of w3.org specification, others may be ripped 
>> from opensource projects that support canonicalization, like libxml2) 
>> and verify your unit against it.
> I draw from libxml2.  First i resolved problem with namespaces. That is 
> not so clear in specification. Even simple xml canonization don't work. 
> Now I can work with more complicate file.
> 
> New version should be send here?
> 
I was intending to implement canonicalization in the existing writer 
(xmlwrite.pp), but namespace support is required before it can be done.
(namespace support is present in dom and xmlread, but not yet in xmlwrite).
Actually, the writer is already doing most of the things, including 
proper encoding and escaping. The attributes are already sorted by name.
What has to be changed:
1) sorting attributes with respect to namespace
2) write end-tags in full form
3) treat CDATA sections as text
4) don't omit defaulted attributes
5) omit xml declaration and DTD.
6) ...maybe missed something else.
The (1) is most difficult, (2) to (5) are pretty trivial.

So for me it seems a better idea to improve the existing writer rather 
than making a new one. I cannot speak on behalf of the whole team, 
however. Other opinions are welcome.

Sergei



More information about the fpc-devel mailing list