[fpc-devel] XML canonical

Dariusz Mazur darekm at emadar.com
Mon Aug 31 15:36:39 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.
> 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.

I've prepare new version of canonization. Its based on xmlwrite. Point 
3,4 are not resolved (I don't it really need) but its trivial.

test against xmllib is not so easy,  because we should follow the same 
indentation on xmlwrite

It works only with simple xml, but its good enough to make proper XADES 
I can submit those unit also, if somebody help me and review it.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xmlwritec14.pas
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090831/e994d0ad/attachment.ksh>

More information about the fpc-devel mailing list