Return-Path: Delivered-To: apmail-synapse-dev-archive@www.apache.org Received: (qmail 17045 invoked from network); 11 Jun 2009 13:41:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jun 2009 13:41:26 -0000 Received: (qmail 2089 invoked by uid 500); 11 Jun 2009 13:41:38 -0000 Delivered-To: apmail-synapse-dev-archive@synapse.apache.org Received: (qmail 2025 invoked by uid 500); 11 Jun 2009 13:41:38 -0000 Mailing-List: contact dev-help@synapse.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@synapse.apache.org Delivered-To: mailing list dev@synapse.apache.org Received: (qmail 2017 invoked by uid 99); 11 Jun 2009 13:41:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 13:41:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 13:41:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5277A234C004 for ; Thu, 11 Jun 2009 06:41:07 -0700 (PDT) Message-ID: <1559831370.1244727667333.JavaMail.jira@brutus> Date: Thu, 11 Jun 2009 06:41:07 -0700 (PDT) From: "Bill Harts (JIRA)" To: dev@synapse.apache.org Subject: [jira] Updated: (SYNAPSE-557) XPath doesn't return attribute value In-Reply-To: <744584085.1244636527356.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SYNAPSE-557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bill Harts updated SYNAPSE-557: ------------------------------- Attachment: changes.patch Changes to SynapseXPath.java to fix the XPath attribute problem. Needs to be applied to the codebase. Bill > XPath doesn't return attribute value > ------------------------------------ > > Key: SYNAPSE-557 > URL: https://issues.apache.org/jira/browse/SYNAPSE-557 > Project: Synapse > Issue Type: Bug > Components: Core > Reporter: Bill Harts > Attachments: changes.patch > > > Problem: > An XPath expression in my synapse.xml configuration file is unable to retrieve an XML attribute from a message. Example: > > > > The message body is: > > > > > > In this case the log mediator always returns null for the sessID variable. > Cause: > After poking around in a bunch of modules I believe that these XPath expressions are being handled in module synapseXPath.java. Specifically there is a call in stringValueOf(MessageContext synCtx) to BaseXPath.evaluate() which returns a List of element pointers retrieved by the XPath expression. The function then correctly checks each element to to determine if it is of type OMTextImpl, OMElementImpl or OMDocumentImpl but when an attribute has been found evaluate() returns an attribute of type DocumentNavigator$OMAttributeEx. It appears that there is no code in stringValueOf() to handle this type of pointer. > Solution: > I added the following code to synapseXpath.java::stringValueOf at line 206: > ... > } else if (o instanceof OMAttributeEx) { > textValue.append( ((OMAttributeEx)o).getAttributeValue()); > } > ... > Also, since the type OMAttributeEx is an inner class of type DocumentNavigator I needed to add an import statement in SynapseXPath.java: > import org.apache.axiom.om.xpath.DocumentNavigator.OMAttributeEx; > Unfortunately, OMAtributeEx is defined as private to class DocumentNavigator so I had to declare class and constructor OMAttributeEx as public in the module DocumentNavigator.java in the Axiom project module axiom-api.jar. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org For additional commands, e-mail: dev-help@synapse.apache.org