Hi,

I'm developing an engine on top of jxpath, but I have a problem executing
context dependable functions (for instance position()).

The issue is the following:

I obtain an Iterator using context.iteratePointers(..).
From each pointer I have to evaluate more xpath (context relative) querys,
but than for the function position() I receive always the value 0.

I was trying to fix it saving the position on the Pointer, externalizing
it; reading it again into the context. It works pretty well for DOM, but
for Beans I'm in trouble. Below is the log of the test case.

Has someone an ideia of an easier implementation for RelativeContext xpath evaluation ?

Thanks
Alessandro

---------------------------------------------------------------------------

    [junit] Running org.apache.commons.jxpath.ri.model.beans.BeanModelTest
    [junit] Tests run: 27, Failures: 1, Errors: 1, Time elapsed: 0,461 sec
[junit] Testsuite: org.apache.commons.jxpath.ri.model.beans.BeanModelTest
    [junit] Tests run: 27, Failures: 1, Errors: 1, Time elapsed: 0,461 sec

    [junit] Testcase: testIndexedProperty took 0,161 sec
    [junit] Testcase: testIndividualIterators took 0,01 sec
    [junit] Testcase: testMultipleIterators took 0,01 sec
    [junit] Testcase: testIteratePropertyArrayWithHasNext took 0 sec
    [junit] Testcase: testIteratePropertyArrayWithoutHasNext took 0 sec
    [junit] Testcase: testIterateAndSet took 0,01 sec
    [junit] Testcase: testIteratePointerSetValue took 0 sec
    [junit] Testcase: testRoot took 0 sec
    [junit] Testcase: testAxisAncestor took 0,01 sec
    [junit] Testcase: testAxisChild took 0,01 sec
    [junit] Testcase: testAxisChildNestedBean took 0 sec
    [junit] Testcase: testAxisChildNestedCollection took 0 sec
    [junit] Testcase: testIndexPredicate took 0,01 sec
    [junit] Testcase: testAxisDescendant took 0,14 sec
    [junit] Testcase: testAxisDescendantOrSelf took 0,02 sec
    [junit] Testcase: testAxisFollowing took 0 sec
    [junit] Testcase: testAxisFollowingSibling took 0,02 sec
    [junit] Testcase: testAxisParent took 0,01 sec
    [junit] Testcase: testAxisPreceding took 0 sec
    [junit] Testcase: testAxisPrecedingSibling took 0,01 sec
    [junit] Testcase: testAxisSelf took 0 sec
    [junit] Testcase: testUnion took 0,01 sec
    [junit]     FAILED
    [junit] Evaluating <count((integers | beans[1]/strings)[name(.) =
'strings'])> expected:<3.0> but was:<0.0>
    [junit] junit.framework.AssertionFailedError: Evaluating
<count((integers | beans[1]/strings)[name(.) = 'strings'])>
expected:<3.0> but was:<0.0>
    [junit]     at
org.apache.commons.jxpath.JXPathTestCase.assertXPathValue(JXPathTestCase.java:54)
    [junit]     at
org.apache.commons.jxpath.ri.model.BeanModelTestCase.testUnion(BeanModelTestCase.java:573)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    [junit] Testcase: testUnionTestcase: testAxisAttribute took 0 sec
    [junit] Testcase: testAttributeName took 0 sec
    [junit] Testcase: testAttributeLang took 0 sec
    [junit] Testcase: testCoreFunctions took 0,01 sec
    [junit] Testcase: testBooleanPredicate took 0,01 sec
    [junit]     Caused an ERROR
    [junit] No value for xpath: beans/strings[name(.)='strings'][2]
    [junit] org.apache.commons.jxpath.JXPathException: No value for xpath:
beans/strings[name(.)='strings'][2]
    [junit]     at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:320)
    [junit]     at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:282)
    [junit]     at
org.apache.commons.jxpath.JXPathTestCase.assertXPathValue(JXPathTestCase.java:53)
    [junit]     at
org.apache.commons.jxpath.ri.model.BeanModelTestCase.testBooleanPredicate(BeanModelTestCase.java:686)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    [junit] Testcase: testBooleanPredicate



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to