Hi all,

Is there a way I can get the parent xpath for a given xpath.

For example, if the xpath I have is as "order/orderItems/item"(a) , I want
to derive parent xpath as "order/orderitems"(b) .

The concern here is I cannot get the elements by (a) and the get it's
parent because that hierarchy will not be available at the time of parsing,
and only up to (b) is available. And the problem is how to derive (b) as a
SynapseXpath.

My queries are :

1. Is there a way to get the parent xpath (by expression alone).

   - I understand that "order/orderItems/item/.." should provide parent
   elements, but this would not work since this complete hierarchy is not
   available.
   - Is it always reliable to split the xpath by "/" and ignore the last
   tag using a regex. Would this work in the case of predicates in the xpath
   (e.g. : /bookstore/book[price>35.00]/title) [1] or any other exceptional
   cases?


2. How to modify a SynapseXpath with the new xpath expression.

   - In synapse codebase, always xpath is created using
   SynapseXPathFactory.getSynapseXPath(OMElement..) which takes in a
   OMElement, which I do not have at this point.
   - I need to directly set the expression and tried using
   SynapseXpath.setExpression(xpath) method. Would this be sufficient, since
   the existing namespaces are all applicable?


[1] http://www.w3schools.com/xpath/xpath_syntax.asp

Thanks,

Maheeka Jayasuriya
Software Engineer
Mobile : +94777750661
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to