Neuron ESB User Network

The Service Bus for the Connected Business

I would expect the following XPath pattern to give me the grandchild of the root node:

var pattern = "@"//*/*/*";


However, this gives me the TEXT of the grandchild instead of the element. I have tried about 5 different online XPath validation tools and they all give me the expected element.

Am I missing something?

(I cannot pull the element out by name, because the name will be unknown and different each time. However I do know it will always be the grandchild of the root node that I need)


Views: 418

Reply to This

Replies to This Discussion

Please provide more information about what you are trying to do. What version of Neuron ESB are you running? Is your XPath part of a Workflow, Business Process or custom code?

I am doing this in a business process C# code block.

Each one of my services return a result in the form of:

 

<SomeServiceResponse>

    <SomeServiceResult>

        <actualResult>123456</actualResult>

...

 

 

I need to generically strip the first to parents from that XML and just return <actualResult> (I won't know what the parents names are).  Using the pattern I indicated in my forum question with GetBodySection doesn't work.  It gives me 123456.  What I need is <actualResult>123456</actualResult>

I am not sure why a namespace in the top level element would matter...the pattern above does not pull anything out by name...only by position.

Every other online XPath validator that I have tried gives me the expected result using the same starting message.

 

David

In that case, the following will work regardless of whether there is or isn't a namespace in the xml:

context.Data.SetProperty("ati","correlationId",context.Data.GetBodySection("/*/*/*/text()"));

I tested this with your posted XML - with and without a namespace. See attached config.
Attachments:

John,

This is pretty close.  However I am not looking for a text value.  I am looking for the element and all of its children that fall below that "/*/*/*".  (This is not related to the correlation ID..we figured that together when you were onsite.  I am trying to extract other response information from an XML wrapper being returned from service calls)

So in the following XML:

<Parent>

   <Child>

      <GrandChild>

        <SomeData>data1</SomeData

        <SomeData2>data2</SomeData2>

      </GrandChild>

...

I am lookng for:

     <GrandChild>

        <SomeData>data1</SomeData

        <SomeData2>data2</SomeData2>

      </GrandChild>

Is there a way to extract this information using GetBodySection?  

If not, I can always use XElement and LinqToXML...

If a namespace is involved in the returned XML, the pattern you posted will not work.  Assuming the name of the tag you are interested is called requestId and assuming it's the text within that tag you are interested, the following pattern will always work regardless of whether there is a namespace or not"

@"//*[local-name() = 'requestId']/text()";

RSS

Neuron ESB Product Support Forums and Communities

Latest Activity

Anupama Nair posted a discussion

Marketo Adapter Invalid Token

Hi,We are using the Marketo adapter to push account updates to Marketo. It works well for some time then starts failing with Invalid Token unless restarted. Is there a configuration that can be done so it can auto refresh the token when required?Thanks!See More
Nov 6, 2023
Sayantini Basak posted a discussion

Maximum payload size(REST API) for requests interfacing to NeuronESB

I am new to Neuron ESB and in our current scenario,We need to process batch transactions comprising of ~1000 records and send them to Neuron ESB for further processing. I would like to understand what is the maximum size of payload that can be transferred using REST interface to Neuron ESB.See More
Jul 22, 2022
Profile IconRobert E Dunie and Sayantini Basak joined Neuron ESB User Network
Apr 28, 2022
Profile IconDayanand, Frederic C, Steffen Greve-Oksfeldt and 1 more joined Neuron ESB User Network
Mar 16, 2022
Profile IconCam Vong and Mitja Luznar joined Neuron ESB User Network
Jan 27, 2022
Profile IconWill Hitzges, Chad Parsons, michael larsen and 4 more joined Neuron ESB User Network
Jun 11, 2021
Anupama Nair posted a discussion

ODBC stored proc polling with temporary tables

We have set up an ODBC adapter to poll a stored proc.We found that if the stored proc has a temporary table defined the rows returned are always 0.Any idea why this would be and what we can do to get around it?See More
Dec 14, 2020
Prasanth Kharade is now a member of Neuron ESB User Network
Dec 30, 2019

Badge

Loading…

© 2024   Created by Neuron Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service