Thanks David.
I'm working on my Xalan bindings for Python and am trying to figure out
a good way to proxy nodesets to and from Python. BTW, here is the
coolest thing that I've done with my bindings so far:
def intersect(nodeset1, nodeset2):
return Pyana.NodeSet([node for node in nodeset1 if node in
nodeset2])
The only semantic difference between my example Python intersect
implementation and the Xalan implementation is that the Python function
expects its arguments to already be nodesets.
Right now I'm trying to work two issues:
1. if the Python function returns a node set containing elements from a
Python DOM, every DOM function must be able to return an exception
(because exceptions are always safe in Python)
2. i have to make Python understand that it can't safely use the node
set (or any of it's nodes) after the lifetime of the function.
Cheers,
Brian
http://pyana.sourceforge.net
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 20, 2001 7:03 AM
> To: [EMAIL PROTECTED]
> Subject: Re: XalanDOM/Nodesets and exceptions
>
>
> The answer to your first question is a qualified "yes." Qualified
because
> I don't think it's ever been tested, so it's hard to say. Since the
> proxies must obey the interfaces, it should be OK. We used to use the
> Xalan source tree for the source and proxied Xerces nodes for result
tree
> fragments, and that worked as expected, but it's been a while since
we've
> done that. I'd say go ahead and experiment, and we'll fix any
problems
> that might arise.
>
> The answer to your second question is most likely yes, but I'd more
> details
> before I give a more definitive answer. At the library level, Xalan
is
> designed to handle any sort of exception at any time. In fact, there
are
> very few try/catch blocks in the code. The basic philosophy is that
any
> call could throw any exception, so always be prepared, or write the
code
> in
> such a way that stack-unwinding as a result of an exception is treated
the
> same way as stack-unwinding as the normal course of execution.
>
> Now, at the application level, the Xalan and testXSLT executables are
not
> necessarily designed to handle any sort of exception that might come
> along.
> But that's an application issue, and not a Xalan issue.
>
> Dave
>
>
>
>
> "Brian Quinlan"
> <brian@sweetapp. To: <xalan-
> [EMAIL PROTECTED]>
> com> cc:
> Subject:
XalanDOM/Nodesets
> and exceptions
> 12/20/2001 02:06
> AM
> Please respond
> to xalan-dev
>
>
>
>
>
>
> I have two questions about valid behavior for Xalan extensions (both
for
> functions and for DOMs):
>
> 1. can a nodeset contain notes from any XalanDOM i.e. can I mix and
> match proxies Xerces nodes, Xalan nodes and proxied nodes from 3rd
party
> DOMs?
>
> 2. is Xalan designed such that any node method can safely throw any
> exception? or could bad things happen?
>
> Cheers,
> Brian
>
>
>