Supplied XPathVariable is bound to the wrong
Added by Anonymous over 16 years ago
Legacy ID: #5154842 Legacy Poster: Ryan Gustafson (rgustav)
I'm working on integrating Saxon-B as the XPath 2.0 engine for PMD. I'm using the net.sf.saxon.sxpath.* packages so things run on 1.4 without JAXP, and the net.sf.saxon.om.* package to adapt the PMD AST in hopes of getting the best performance possible. While trying to expose Rule properties as variables, I'm getting the same error "Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context", as describe in this thread about a month ago: http://sourceforge.net/mailarchive/forum.php?thread_name=486DF502.3000506%40uva.nl&forum_name=saxon-help I debugged a bit, and the problem seemed to be caused by an ordering problem when taking XPathVariables from a Map, and placing them into a List, and still assuming the 'slotNumber' on the XPathVariable works in the List. Supposedly there's a fix for this in SVN. I'm not having any luck building SVN using 'build.xml bj', as it seems to want some code from Saxon-SA available? Is there documentation available on doing builds from SVN? Or, is there a regular snapshot of SVN available somewhere that I can test out to see if the problem is corrected? Another question on setting variable values... the only way I've figured out how to do this so far is to define the XPathVariables using the XPathStaticContext from the XPathEvaluator, saving the XPathVariables off, and then getting an XPathExpression, creating a XPathDynamicContext, and calling setVariable(XPathVariable,ValueRepresentation) using the XPathVariable references from earlier. Is there a more direct way to set variable values? If not, is there an easier route to get the XPathVariable references when I'm working with the XPathDynamicContext, that doesn't require me to manual remember them when I define them? I'm really just looking for something like XXXContext.setVariable(String variableName, Object value), but it doesn't appear to be that straightforward with these APIs. (The javax.xml.xpath APIs are much easier, but that requires JAXP, and performance using DOM was 3 times works than Jaxen). Thanks, Ryan
Replies (3)
Please register to reply
RE: Supplied XPathVariable is bound to the wr - Added by Anonymous over 16 years ago
Legacy ID: #5154892 Legacy Poster: Michael Kay (mhkay)
I'm not sure what PMD is but I don't think it matters. As you say, this is a known bug and there's a patch for it in Subversion. There will be a maintenance build that incorporates the patches already issued in Subversion at some stage, but I'm afraid it won't be in the next couple of weeks because of holidays. The 9.1 release has proved pretty reliable: this is about the only real showstopper bug, and it only affects a small number of users being local to the XPath API. If you want to build it yourself, there are basically two approaches: (a) just drop all the source files into your IDE and work from there, or (b) start with the Ant build.Xml file, strip out the bits you don't need, like the Saxon-SA and Saxon on .NET parts, and change properties to refer to the correct file locations. >Another question on setting variable values... You're right about how this is done in sxpath. I'm not wildly enthusiastic about the design these days. I don't much like the way JAXP does it either (at any rate, it's a really bad fit to the internal Saxon architecture, which assumes that variables will be declared to the XPath compiler in advance). I think the s9api design is much better, but that's JDK 1.5 only. Michael Kay Saxonica
RE: Supplied XPathVariable is bound to the wr - Added by Anonymous over 16 years ago
Legacy ID: #5154913 Legacy Poster: Ryan Gustafson (rgustav)
PMD is http://pmd.sourceforge.net/ and yup, it doesn't matter. I'll futz with the Ant build to get something working. Thanks much! Ryan
RE: Supplied XPathVariable is bound to the wr - Added by Anonymous over 16 years ago
Legacy ID: #5155863 Legacy Poster: Peter B. West (pbw)
The wiki documents the 9.0.0.3 build using NetBeans. http://saxon.wiki.sourceforge.net/Compiling+Saxonb9j+using+NetBeans If you have NetBeans and an svn client, you can get co from svn through NB. In any case, when you have the current tree, the build instructions will be very similar. Even if you don't use NB, the steps in there will probably give you enough information to enable you to build.
Please register to reply