[fpc-devel] XML canonical

Dariusz Mazur darekm at emadar.com
Fri Aug 28 18:53:38 CEST 2009

Sergei Gorelkin pisze:
> 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.
6.sorting namespaces
7. added default namespace (exists above main node - when we write only 
part of tree)
> 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.
Now I see what want. Till now I work on old implementation of xmlwrite 
(C-style) and not notice that was change.
I can try  reimplement it based on exists. it seem easy.


More information about the fpc-devel mailing list