Selection only one child that match the Parent Name xpath 1.0 - xpath

So I have this XMl file to filter using XPATH.
`<Root>
<Program Name="PGM_Name1">
<ProgFileName>200</ProgFileName>
<ProgName>PGM_Name</ProgName>
<NcJob>
<Name>Job1</Name>
<NcJob>
</Program>
<Program Name="PGM_Name">
<ProgFileName>200</ProgFileName>
<ProgName>PGM_Name1</ProgName>
<NcJob>
<Name>Job2</Name>
<NcJob>
</Program>
<Program Name="PGM_Name2">
<ProgFileName>201</ProgFileName>
<ProgName>PGM_Name2</ProgName>
<NcJob>
<Name>Job3</Name>
<NcJob>
</Program>
</Root>`
And what I want is to select only one element <Name> from each <Program> parent.
The struggle is how to match the <ProgFileName> on each <Program> element.
The Context node that I need to use is <Name>
So I cannot do anything similar to //NcJob/Name != ./preceding::Program/NcJob/Name
Any help here?
Thank you for your time!

You can use the following XPath expression which respect the conditions you've stated :
//Name[preceding::ProgName[1]/text()=ancestor::Program[1]/#Name]
Output : Job3

Related

How to check if a element exists in xml using xpath

This is my XMl file and I want to know if the Element "SCENE" which has has a value "SCENE_TestSene" exists.
This is my current code.
if (xmlDoc.SelectSingleNode("//DATABASE/SCENE") == null).......
but I am not able to figure out how to check for the scene name in the xpath ?
<DATABASE>
<SCENE SCENE_NAME="SCENE_TestSene">
<TEMPLATE_Test>
<Image1>C:\Temp\Pitch_Positions.jpg</Image1>
<text1>DDASD</text1>
<text2>ADASDSA</text2>
</TEMPLATE_Test>
</SCENE>
<SCENE SCENE_NAME="SCENE_NewSene">
<TEMPLATE_Test1>
<Image1>C:\Temp\Pitch_Positions.jpg</Image1>
<text1>DDASD</text1>
<text2>ADASDSA</text2>
</TEMPLATE_Test1>
</SCENE>
</DATABASE>
Instead of
"//DATABASE/SCENE"
try
"//DATABASE/SCENE[#SCENE_NAME='SCENE_TestSene']"

xpath issue with selectSingleNode when switch to XML 6

This is my XML:
<?xml version="1.0"?>
<Revision>
<Revision Index="1"/>
</Revision>
When using DomDocument(ver 3) I could run the following(In VB6):
Set objNode = objDom.documentElement.selectSingleNode("//.[#Index = '1']")
This is to identify that this attribute exists with it's value.
Now after moving to DomDocument60(ver 6) this line fails.
How should I re-write it so it works with DomDocument60?
Thanks in advance
Doron
You could try using the XPath:
//Revision[#Index="1"]
This will select all Revision nodes in the document that have the attribute Index="1".

Wix - How to remove the parent set of nodes using XmlConfig and Xpath

How do i find a text() node in XmlConfig and use it to remove the parent nodeset. All the examples I have seen just find and remove the 'found' node not the parent nodes.
My understanding is that this Xpath finds the matching node via verify path and ElementPath is the path of the nodes to remove. However Its not working at all.
Is text() supported?, I have tried [[*='ATrigger'[]], [[].='ATrigger'[]] but still no luck.
<util:XmlConfig Id="RemoveATriggerCompletely" File="[#QuartzXmlJob]" Sequence="104" Action="delete" On ="install" Node="element"
ElementPath="//job-scheduling-data/schedule/"
VerifyPath="//job-scheduling-data/schedule/trigger/cron/name[\[]text()='ATrigger'[\]]"/>
Given the following XML
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<schedule>
<trigger>
<cron>
<name>ATrigger</name>
<group>default</group>
<description>Every 2 minutes</description>
<job-name>ATriggerJob</job-name>
<job-group>defaultGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<!-- every 5mins -->
<cron-expression>2 * * * * ?</cron-expression>
</cron>
</trigger>
<trigger>
<cron>
<name>BTrigger</name>
<group>default</group>
<description>Every 2 minutes</description>
<job-name>BTriggerJob</job-name>
<job-group>defaultGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<!-- every 5mins -->
<cron-expression>2 * * * * ?</cron-expression>
</cron>
</trigger>
The output i require is
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<schedule>
<trigger>
<cron>
<name>BTrigger</name>
<group>default</group>
<description>Every 2 minutes</description>
<job-name>BTriggerJob</job-name>
<job-group>defaultGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<!-- every 5mins -->
<cron-expression>2 * * * * ?</cron-expression>
</cron>
</trigger>
I have been banging my head against a wall for hours now so any help whatsoever is very much appreciated.
I'm not familiar with that "XmlConfig" task.
But I see two issues.
You need to alias the namespace and use that alias for the xpath "select".
I show the XmlPeek version below. Note I use "peanut", you can use any alias name you want.
Note the query now has "peanut:" in all the element names.
<!-- you do not need a namespace for this example, but I left it in for future reference -->
<XmlPeek Namespaces="<Namespace Prefix='peanut' Uri='http://quartznet.sourceforge.net/JobSchedulingData'/>"
XmlInputPath=".\Parameters.xml"
Query="//peanut:job-scheduling-data/peanut:schedule/peanut:trigger/peanut:cron/peanut:name[text()='ATrigger']/../..">
<Output TaskParameter="Result" ItemName="Peeked" />
</XmlPeek>
Note my "../.."
Once you find the correct element, finding its parent(s) is simple as the ".." notation.
You'll need to figure out how to add the namespace and alias to your Task (XmlConfig)
APPEND:
http://sourceforge.net/p/wix/bugs/2384/
Hmmm...dealing with a namespace isn't trivial. I think you're having a similar issue to what is reported there.
APPEND:
"Inline" Namespacing ... (Yuck)
<XmlPeek
XmlInputPath=".\Parameters.xml"
Query="//*[local-name()='job-scheduling-data' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='schedule' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='trigger' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='cron' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='name' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData'][text()='ATrigger']/../..">
<Output TaskParameter="Result" ItemName="Peeked" />
</XmlPeek>
Aka, try this Xpath:
"//*[local-name()='job-scheduling-data' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='schedule' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='trigger' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='cron' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData']/*[local-name()='name' and namespace-uri()='http://quartznet.sourceforge.net/JobSchedulingData'][text()='ATrigger']/../.."

soapui how to get the list of nodes by using local-name in xpath expression?

I am using soapui for automation testing. I am trying to write a xpath expression to do the property transfer with following xml
<snapshots query="after=2014-04-16 12:30:00-0700" mask="op" xmlns="http://ws.example.com/roma/201907" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AsOf>2014-04-16T19:20:44-07:00</AsOf>
<offers>
<offer entityId="6500588"/>
<offer entityId="6500589"/>
<offer entityId="6500590"/>
<offer entityId="6557335">
<rubber>KJM</rubber>
<code>B44733</code>
<offerCode>PA</offerCode>
<status name="Completed">C</status>
<startDate basis="GMT-4">2013-04-01</startDate>
<endDate basis="GMT-4">2014-04-15</endDate>
<template>
<sourceKey-Ref entityId="36KTV" code="KPA513C36KTV" uri="/snapshot/sourcekey/36KTV"/>
<pTemplateCode>PPAKXC</pTemplateCode>
<panelCode>HPA5LTM</panelCode>
<itemCode>PA1467</itemCode>
</template>
<venue code="28">
<supervenue>5</supervenue>
</venue>
<currencyDetail currency="USD">
<unitPrice>29.95</unitPrice>
<numberPayments>1</numberPayments>
</currencyDetail>
<hData>
<legacyScriptCode>300</legacyScriptCode>
<hpKeycode>189161</hpKeycode>
<hpProductNumber>014399</hpProductNumber>
<hpMpgCode>300</hpMpgCode>
</hData>
</offer>
<offer entityId="6557336">
<rubber>KJM</rubber>
<code>B44734</code>
<offerCode>VY</offerCode>
<status name="Completed">C</status>
<startDate basis="GMT-4">2013-04-01</startDate>
<endDate basis="GMT-4">2014-04-15</endDate>
<template>
<sourceKey-Ref entityId="36KTV" code="KPA513C36KTV" uri="/snapshot/sourcekey/36KTV"/>
<pTemplateCode>PPAKXC</pTemplateCode>
<panelCode>HPA5LTM</panelCode>
<offerCode>OVYC8UM9</offerCode>
<itemCode>VY4023</itemCode>
</template>
<venue code="28">
<supervenue>5</supervenue>
</venue>
<currencyDetail currency="USD">
<unitPrice>0.00</unitPrice>
<numberPayments>1</numberPayments>
</currencyDetail>
<hData>
<legacyScriptCode>947</legacyScriptCode>
<hpKeycode>189162</hpKeycode>
<hpProductNumber>602185</hpProductNumber>
<hpMpgCode>947</hpMpgCode>
</hData>
</offer>
<offer entityId="6557337">
<rubber>KJM</rubber>
<code>B44736</code>
<offerCode>VY</offerCode>
<status name="Completed">C</status>
<startDate basis="GMT-4">2013-04-01</startDate>
<endDate basis="GMT-4">2014-04-15</endDate>
<template>
<sourceKey-Ref entityId="36KTV" code="KPA513C36KTV" uri="/snapshot/sourcekey/36KTV"/>
<pTemplateCode>PPAKXC</pTemplateCode>
<panelCode>HPA5LTM</panelCode>
<offerCode>OVYC8UMA</offerCode>
<itemCode>VY4012</itemCode>
</template>
<venue code="28">
<supervenue>5</supervenue>
</venue>
<currencyDetail currency="USD">
<unitPrice>0.00</unitPrice>
<numberPayments>1</numberPayments>
<firstPaymentAmount>0.00</firstPaymentAmount>
<firstShippingAmount>5.98</firstShippingAmount>
</currencyDetail>
<hData>
<legacyScriptCode>947</legacyScriptCode>
<hpKeycode>189163</hpKeycode>
<hpProductNumber>602094</hpProductNumber>
<hpMpgCode>947</hpMpgCode>
</hData>
</offer>
</offers>
</snapshots>
I would like to have all hpKeycode using local-name() in the XPath expression. I tried
//*[local-name()='hpKeycode']
but this gives me only the first node which is 189161. This
/*[local-name()='hpKeycode'][2]
also does not work. Any help would be greatly appreciated.
You can try with XQuery. In the property transfer step select Use XQuery checkbox as you see in the image below. And use this code:
declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://ws.example.com/roma/201907';
<ns1:offer>
{
for $id in //*[local-name()='hpKeycode'] return string($id)
}
</ns1:offer>
EDIT:
If you want to avoid the use of XQuery, you can add three Transfers on your property transfer, on each one use:
First id
(//*[local-name()='hpKeycode'])[1]
Second id
(//*[local-name()='hpKeycode'])[2]
Third id
(//*[local-name()='hpKeycode'])[3]
Hope this helps,
This would not work in the way you expect it to because you are pulling a single set of values. You would need to specify what node branch you want further up the tree.
Its like road ways... if you were giving someone directions you would need to inform them which way to go for each fork in the road. Lets say you wanted to tell them how to get to one of 3 possible airports each located in a different city. If you said "as you arrive at airports 1,2, and 3 enter the 2nd". They would be baffled and say something like "what city though?" and maybe "its not possible for them to exist in the same location".
Solution:
Here is what you would want given the xml you provided (both work in soapui).
Xpath 2.0
//*:offer[4]/*:hData/*:hpKeycode
//*:offer[5]/*:hData/*:hpKeycode
//*:offer[6]/*:hData/*:hpKeycode
Xpath 1.0
//*[local-name()='offer'][4]/*[local-name()='hData']/*[local-name()='hpKeycode']
//*[local-name()='offer'][5]/*[local-name()='hData']/*[local-name()='hpKeycode']
//*[local-name()='offer'][6]/*[local-name()='hData']/*[local-name()='hpKeycode']
Hope this more detailed explanation helps!

Mule expression in logger component not valid xpath

I have an xml like this:
<order>
<orderheader>
<orderissuedate>1/11/2013</orderissuedate>
</orderheader>
</order>
in the mule logger component set with INFO, i have a mule expression that tries to print out the orderissuedate 1/11/2013.
i use the expression:
[xpath('/order/orderheader//orderissuedate')] which didn't work.
i also tried: #[xpath('/order/orderheader/orderissuedate/text()').text] that didnt work also.
can someone tell me what the correct xpath expression is. i get this error message:
java.lang.RuntimeException: org.mule.api.MuleRuntimeException: Failed to evaluate XPath expression: "/Order/OrderHeader/OrderIssueDate/text()"
I've tested these xpath expressions using online xpath checkers, and they seem to work. thanks for your help.
Here is the original xml:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Order>
<Order
xmlns:core="rrn:org.xcbl:schemas/xcbl/v4_0/core/core.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OrderHeader>
<OrderNumber>
<BuyerOrderNumber>111111</BuyerOrderNumber>
</OrderNumber>
<OrderIssueDate>2013-06-28T08:40:12</OrderIssueDate>
<OrderReferences>
<AccountCode>
<core:RefNum></core:RefNum>
</AccountCode>
</OrderReferences>
</OrderHeader>
</Order>
and the error output from mule:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
java.lang.RuntimeException: org.mule.api.MuleRuntimeException: Failed to evaluate XPath expression: "/OrderIssueDate"
at org.mule.module.xml.el.XPathFunction.call(XPathFunction.java:50)
at org.mule.el.mvel.MVELFunctionAdaptor.call(MVELFunctionAdaptor.java:38)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1011)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:987)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:377)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
at org.mvel2.MVEL.executeExpression(MVEL.java:942)
at org.mule.el.mvel.MVELExpressionExecutor.execute(MVELExpressionExecutor.java:50)
at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:214)
at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:163)
at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:142)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:220)
at org.mule.expression.DefaultExpressionManager$2.match(DefaultExpressionManager.java:481)
at org.mule.util.TemplateParser.parse(TemplateParser.java:153)
at org.mule.util.TemplateParser.parse(TemplateParser.java:130)
at org.mule.expression.DefaultExpressionManager.parse(DefaultExpressionManager.java:477)
at org.mule.expression.DefaultExpressionManager.parse(DefaultExpressionManager.java:436)
at org.mule.api.processor.LoggerMessageProcessor.log(LoggerMessageProcessor.java:89)
at org.mule.api.processor.LoggerMessageProcessor.process(LoggerMessageProcessor.java:71)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at com.mulesoft.mule.module.datamapper.processors.DataMapperMessageProcessor.process(DataMapperMessageProcessor.java:132)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mule.api.MuleRuntimeException: Failed to evaluate XPath expression: "/OrderIssueDate"
at org.mule.module.xml.expression.AbstractXPathExpressionEvaluator.evaluate(AbstractXPathExpressionEvaluator.java:144)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:311)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:230)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:186)
at org.mule.module.xml.el.XPathFunction.call(XPathFunction.java:43)
... 60 more
Caused by: org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=java.util.LinkedHashMap, mimeType='*/*'}" to "SimpleDataType{type=org.dom4j.Document, mimeType='*/*'}".
at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:355)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:313)
at org.mule.module.xml.expression.AbstractXPathExpressionEvaluator.getPayloadForXPath(AbstractXPathExpressionEvaluator.java:154)
at org.mule.module.xml.expression.AbstractXPathExpressionEvaluator.evaluate(AbstractXPathExpressionEvaluator.java:115)
... 64 more
ERROR 2013-08-26 00:40:49,893 [[mule_egc2].EGC_FlowFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Could not find a transformer to transform "SimpleDataType{type=java.util.LinkedHashMap, mimeType='*/*'}" to "SimpleDataType{type=org.dom4j.Document, mimeType='*/*'}".
Code : MULE_ERROR-236
--------------------------------------------------------------------------------
Exception stack is:
1. Could not find a transformer to transform "SimpleDataType{type=java.util.LinkedHashMap, mimeType='*/*'}" to "SimpleDataType{type=org.dom4j.Document, mimeType='*/*'}". (org.mule.api.transformer.TransformerException)
org.mule.registry.MuleRegistryHelper:252 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=java.util.LinkedHashMap, mimeType='*/*'}" to "SimpleDataType{type=org.dom4j.Document, mimeType='*/*'}".
at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:355)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:313)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Use this:
<logger message="OrderIssueDate is #[xpath('//Order/OrderHeader/OrderIssueDate').text]" level="INFO" />
Make sure that to use the case correctly for your XML elements hierarchy. You have order in top XML while Order in lower one and so on
the xpath expression that would work according to me is #[xpath://orderissuedate] To print using the logger you should use something like <logger message="#[xpath://orderissuedate]" level="INFO"/>
From the conversation on one of the answers the following solutions hould work.
<logger message="Value of Order Issue Date #[xpath('//OrderIssueDate').text]" level="INFO" />
It would be better if the DTD of the Order is also provided.
Your original XML seems to have namespace :-
xmlns:core="rrn:org.xcbl:schemas/xcbl/v4_0/core/core.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
So, if you need to extract the value using Xpath from your original XML, you need Mule namespace manger :- https://developer.mulesoft.com/docs/display/current/XML+Namespaces
Other than that if you want to extract the value from your XML you shown above, you can use the Mules latest Xpath3 available right now from Mule version 3.6 which is easy to use :- https://developer.mulesoft.com/docs/display/current/XPath
Hope it helps you :)
You can use the mule latest xpath3 like this if you are getting namespaces
[xpath3('//*:orderissuedate/text()')]
Try this, it may help:
#[xpath3('//order/orderheader/orderissuedate/text()')]

Resources