<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>i have a few questions regarding your c14n
implementations.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>First if you have any plans for c14n 1.1
implementation. It is currently already marked as Proposed Recomendation (<A
href="http://www.w3.org/TR/xml-c14n11/">http://www.w3.org/TR/xml-c14n11/</A>)
since janurary 2008. I reported it in bugzilla as new feature request
<A
href="http://bugzilla.gnome.org/show_bug.cgi?id=524929">http://bugzilla.gnome.org/show_bug.cgi?id=524929</A>.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Now regarding your 2 c14n implementations. I am
currently doing some c14n performance optimizations (well using msxml4
parser) and I am also studiing/evaluating
your implementations:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><A
href="http://anonsvn.mono-project.com/source/trunk/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs">http://anonsvn.mono-project.com/source/trunk/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs</A></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>and</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="http://svn.gnome.org/viewvc/libxml2/trunk/c14n.c?revision=3430&view=markup">http://svn.gnome.org/viewvc/libxml2/trunk/c14n.c?revision=3430&view=markup</A><BR></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Question 1:</FONT></DIV>
<DIV><FONT face=Arial size=2>What does </FONT><FONT face=Arial
size=2>FillMissingPrefixes function? It seems to expand namespace
attributes to all children (and theirs children)</FONT></DIV>
<DIV><FONT face=Arial size=2><a xmlns="bla"></FONT><FONT face=Arial
size=2><b/></a></FONT></DIV>
<DIV><FONT face=Arial size=2>to</FONT></DIV>
<DIV><FONT face=Arial size=2><a xmlns="bla"><b
xmlns="bla"/></a></FONT></DIV>
<DIV><FONT face=Arial size=2>If that is the case why is there
need inside WriteNamespacesAxis to iterate for each node through
all of its parents (if each node has already all their namespace
attribute). Well another thing is that changing original xml is bad (well
IMHO :) ). Apache xml security also does that, but it cleans them after c14n.
Older versions didn't do that and you ended up with million namespaces all
over xml and twice the size after signing it.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Question 2:</FONT></DIV>
<DIV><FONT face=Arial size=2>Whould it be cleaner to just use xpath expression
"namespace::*" (and faster ??? and not needing xpath hack inside c14n.c in
libxml2). With precompiled xpath it could really work.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>As in (just some pseudo code): </FONT></DIV>
<DIV><FONT face=Arial size=2>foreach (node in xNode.selectNodes("namespace::*")
{</FONT></DIV>
<DIV><FONT face=Arial size=2> if IsNamespaceRendered (node.prefix,
node.Value) and IsNodeVisible(node) ...</FONT></DIV>
<DIV><FONT face=Arial size=2> ...</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Instead of all that FillMissingPrefixes + parent
node iterating and xmlSearchNS + parent node iterating (and each xmlSearchNS
call doing it all over again) ...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Question 3:</FONT></DIV>
<DIV><FONT face=Arial size=2>Another posibility is to stacking all
namespaces along the way (and without using XPath) ... as is done for
rendered naspaces ... except it could save all namespaces with additional
allreadyRendered flag.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> xmlNsPtr
*nsTab; /* array of ns in no particular order
*/ <BR>
xmlNodePtr *nodeTab; /* array of nodes in no particular order
*/<BR> byte *allreadyRendered /* array of nodes
*/</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>and then searching for matching xmlNsPtr backwards
(nsCurEnd to 0 ...) ... and when finding ns
element checking it if it was allreadyRendered ... if
not adding it to the output list and setting allreadyrendered flag to true
(before checking it with xmlC14NIsVisible ...).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>According to our tests
your xmlC14NProcessNamespacesAxis is the slowest part of libxml2 c14n
processing.</FONT><FONT face=Arial size=2> And if I can help
somehow to optimize it ...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you,</FONT></DIV>
<DIV><FONT face=Arial size=2>Matej Spiller-Muys</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>