Fwd: Is net.sf.saxon.functions.DeepEqual.deepEquals thread safe?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Is net.sf.saxon.functions.DeepEqual.deepEquals thread safe?

Brian

I have two XdmNode (s) and I want to verify if they are equal or not.  

Here is what I wrote:
https://gist.github.com/BDF/9bcb82761b169398fcbe

I've created the LocalErrorListener because it looks like there is one global ErrorListener per Configuration object and I don't want the errors crossing streams.   The code will in exist in the context of a Spring service supporting a REST interface.

Is there a better way to compare to XdmNode(s)?    I started writing writing something myself based on  XdmNode:axisIterator  but pretty quickly got bogged down.   I could convert them to Strings and normalize them but that seems a pretty heavy weight process considering they are already in XdmNode form.

Thanks,
Brian F.







------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Is net.sf.saxon.functions.DeepEqual.deepEquals thread safe?

Michael Kay
Sorry for the delay in picking this out of the moderation queue - SourceForge lists are so heavily spammed that the few genuine messages that come up for moderation are easily overlooked.

I think there are a couple of problems with the code.

Firstly, I don't think explanations of non-equality get written anywhere unless the flag WARNING_IF_FALSE is set.

Secondly, in general, nodes belong to a Configuration and aren't usable with a different Configuration. You might get away with it, but it's not safe. At the very least you should make sure that the original and new Configuration's share the same NamePool.

Apart from that, it's messy, but should be OK. But you might be better off copying-and-pasting the whole code and creating something with a more usable interface. Alternatively, consider executing an XPath expression that contains a call to saxon:deep-equal().

Michael Kay
Saxonica


On 9 Feb 2016, at 17:20, Brian <[hidden email]> wrote:


I have two XdmNode (s) and I want to verify if they are equal or not.  

Here is what I wrote:
https://gist.github.com/BDF/9bcb82761b169398fcbe

I've created the LocalErrorListener because it looks like there is one global ErrorListener per Configuration object and I don't want the errors crossing streams.   The code will in exist in the context of a Spring service supporting a REST interface.

Is there a better way to compare to XdmNode(s)?    I started writing writing something myself based on  XdmNode:axisIterator  but pretty quickly got bogged down.   I could convert them to Strings and normalize them but that seems a pretty heavy weight process considering they are already in XdmNode form.

Thanks,
Brian F.






------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help