Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 18144 invoked from network); 17 Jan 2004 03:31:35 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 17 Jan 2004 03:31:35 -0000 Received: (qmail 54975 invoked by uid 500); 17 Jan 2004 03:31:06 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 54928 invoked by uid 500); 17 Jan 2004 03:31:06 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 54863 invoked from network); 17 Jan 2004 03:31:06 -0000 Received: from unknown (HELO sccrmhc12.comcast.net) (204.127.202.56) by daedalus.apache.org with SMTP; 17 Jan 2004 03:31:06 -0000 Received: from plotnix2500 (pcp02137893pcs.reston01.va.comcast.net[68.48.26.233]) by comcast.net (sccrmhc12) with SMTP id <20040117033115012002m3hhe>; Sat, 17 Jan 2004 03:31:15 +0000 Message-ID: <00c401c3dcaa$5f975490$0500a8c0@plotnix2500> From: "Dmitri Plotnikov" To: "Jakarta Commons Users List" , "Jakarta Commons Developers List" References: <3FF8A993.7070502@web.de> Subject: Re: [jxpath] using the last() function? (repost) Date: Fri, 16 Jan 2004 22:31:20 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Joern, The last() function is now fixed. - Dmitri ----- Original Message ----- From: "joern turner" To: "Jakarta Commons Users List" Sent: Sunday, January 04, 2004 7:02 PM Subject: [jxpath] using the last() function? (repost) > Hello, > > first of all, thanks for this great piece of code - its a vital part of > our own open-source project. > > but i have a problem using the last() function in jxpath. i'm using the > following xml: > > > > > 500 > 100 > > > 77 > 77 > > > > > i'm trying to get the last element of a nodeset like this: > > JXPathContext context = JXPathContext.newContext(doc); > > Pointer pointer1 = context.getPointer("//my:order/my:item[2]"); > assertTrue(pointer1.asPath().equals("/instance[1]/my:order[1]/my:item[2]")); > > works ok. > > Pointer pointer2 > =context.getPointer("//my:order/my:item[position()=count(../*)]"); > assertTrue(pointer2.asPath().equals("/instance[1]/my:order[1]/my:item[2]")); > > works ok. > > Pointer pointer3 = > context.getPointer("//my:order/my:item[position()=2]"); > assertTrue(pointer3.asPath().equals("/instance[1]/my:order[1]/my:item[2]")); > > works ok. > > Pointer pointer4 = context.getPointer("//my:order/my:item[last()]"); > assertTrue(pointer4.asPath().equals("/instance[1]/my:order[1]/my:item[2]")); > > fails with stacktrace. what am i doing wrong? please help. i've > investigated the problem but cannot find a way to get it working. > > any help appreaciated. > > Joern > > testLast(org.chiba.xml.xforms.xpath.test.JXPathTest)java.lang.NullPointerExc eption > at > org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator.previous(DOMNodeItera tor.java:131) > at > org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator.setPosition(DOMNodeIt erator.java:121) > at > org.apache.commons.jxpath.ri.axes.ChildContext.setPosition(ChildContext.java :152) > at > org.apache.commons.jxpath.ri.compiler.CoreFunction.functionLast(CoreFunction .java:335) > at > org.apache.commons.jxpath.ri.compiler.CoreFunction.computeValue(CoreFunction .java:259) > at > org.apache.commons.jxpath.ri.axes.PredicateContext.nextNode(PredicateContext .java:127) > at > org.apache.commons.jxpath.ri.EvalContext.getSingleNodePointer(EvalContext.ja va:333) > at > org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:211) > at > org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path .java:192) > at > org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath .java:128) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getPointer(JXPathCon textReferenceImpl.java:366) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getPointer(JXPathCon textReferenceImpl.java:362) > at > org.chiba.xml.xforms.xpath.test.JXPathTest.testLast(JXPathTest.java:162) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > at > com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12) > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org