[XML-SIG] combine vs split (was: SAX namespaces discussion status)

Greg Stein gstein@lyra.org
Thu, 6 Jul 2000 15:47:55 -0700


But if the data arrives already-split, then the application is ahead of the
game. It may never need to recombine it.

If the data arrives joined, then the app is probably going to have to split
the thing.

in your example, I would always go with the simple string concatenations
over the split() invocation. Consider that the output is probably going to
look like this:

  f.write("<%s:%s>data</%s:%s>", prefix, localname, prefix, localname)

Very easy and straightforward. It is much more untuitive than that code to
split up the prefix/localname.

Cheers,
-g

On Thu, Jul 06, 2000 at 11:18:33AM -0500, Paul Prescod wrote:
> Uche Ogbuji wrote:
> > 
> > 4XPath and 4XSLT are absolutely littered with SplitQName() calls
> > that would be somewhat reduced in this case.
> 
> I claim that it is not SAX's fault that you need to do all of these
> SplitQName's.
> 
> SAX can only force you to code two SplitQName calls: one for elements 
> and one for attributes. Once you have the prefix you never lose it 
> unless you throw it away!
> 
> The DOM does require you to do SplitQName() calls in createElementNS,
> but SAX can't help you avoid those.
> 
> XSLT will also force you to do SplitQName when you see prefixes in
> XPath select attribute values (not names). Once again, SAX won't 
> help there.
> 
> Let's also consider the argument that gluing is easier than splitting.
> The code for gluing looks something like:
> 
> if prefix:
> 	rawname=prefix+":"+localname
> else:
> 	rawname=localname
> 
> 
> 
> The code for splitting is (something like):
> 
> pair=rawname.split( ":" )
> if len( pair>1 ):
> 	prefix=pair[0]
> else:
> 	prefix=""
> 
> 
> Not a big difference in my mind.
> 
> -- 
>  Paul Prescod - Not encumbered by corporate consensus
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig

-- 
Greg Stein, http://www.lyra.org/