xPath question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server Orchestration > xPath question




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    xPath question  
Yossi Dahan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-01-05 01:09 PM

Hi all,

I've got an orchestration that receives an xml that is structured
something like:

<A>
<b>
<c>text 1</c>
</b>
<b>
<c>text 2</c>
</b>
</A>

I need to loop and get values of all c element

I have a loop shape based on count of c using xpath - count(/A/b/c)
which works just fine.

then I'm trying to extract the c element using the xpath "/A/b[i]/c"
where i is the counter of the loop+1 but I'm getting an empty string as
if the node was not found.

checking the same xpath in an external xml tool works fine, I would
expect it to work in the orchestration just as well..


Anyone sees what I'm missing?

Thanks

Yossi Dahan





[ Post a follow-up to this message ]



    Re: xPath question  
Scott Colestock


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-01-05 10:51 PM

Try: /A/b[position()=i]/c

or string(/A/b[position()=2]/c) if you want the element content rather t
han
the node.

Scott Colestock
www.traceofthought.net


"Yossi Dahan" <yossi.dahan@sabratech.co.uk> wrote in message
news:um9CjjplFHA.3960@TK2MSFTNGP12.phx.gbl...
> Hi all,
>
> I've got an orchestration that receives an xml that is structured
> something like:
>
> <A>
>    <b>
>       <c>text 1</c>
>    </b>
>    <b>
>       <c>text 2</c>
>    </b>
> </A>
>
> I need to loop and get values of all c element
>
> I have a loop shape based on count of c using xpath - count(/A/b/c) which
> works just fine.
>
> then I'm trying to extract the c element using the xpath "/A/b[i]/c" w
here
> i is the counter of the loop+1 but I'm getting an empty string as if the
> node was not found.
>
> checking the same xpath in an external xml tool works fine, I would expect
> it to work in the orchestration just as well..
>
>
> Anyone sees what I'm missing?
>
> Thanks
>
> Yossi Dahan







[ Post a follow-up to this message ]



    Re: xPath question  
Marvin Smit


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-01-05 10:51 PM

Hi,

ehh... I see you basing the counter on the C nodes, but try to use the
counter in the B position. I think you still need to 'count the C's'.

/A/b/c[count(preceding::c)=i]

Hope this helps,

Marvin Smit.

Ps: this is assuming i = 0 based, if i = 1 based.. use (i-1) ;)


On Mon, 1 Aug 2005 09:43:06 -0500, "Scott Colestock"
<scolestock@community.nospam> wrote:

>Try: /A/b[position()=i]/c
>
>or string(/A/b[position()=2]/c) if you want the element content rather 
than
>the node.
>
>Scott Colestock
>www.traceofthought.net
>
>
>"Yossi Dahan" <yossi.dahan@sabratech.co.uk> wrote in message
>news:um9CjjplFHA.3960@TK2MSFTNGP12.phx.gbl... 
>






[ Post a follow-up to this message ]



    Re: xPath question  
Yossi Dahan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-02-05 12:50 PM

Marvin Smit wrote:
> Hi,
>
> ehh... I see you basing the counter on the C nodes, but try to use the
> counter in the B position. I think you still need to 'count the C's'.
>
> /A/b/c[count(preceding::c)=i]
>
> Hope this helps,
>
> Marvin Smit.
>
> Ps: this is assuming i = 0 based, if i = 1 based.. use (i-1) ;)
>
>
> On Mon, 1 Aug 2005 09:43:06 -0500, "Scott Colestock"
> <scolestock@community.nospam> wrote:
>
> 
>
Thanks for the answer guys, but I'm still not getting anything, I
changed my simple [i] to [position=1], but it did not make any
difference. I've tried the string method before I've posted (as you'd
expect) and it did not make a difference)

The count itself works great, it's just extracting the nodes text that
doesn't happen.

Yossi Dahan





[ Post a follow-up to this message ]



    Re: xPath question  
Scott Colestock


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-02-05 10:57 PM

I notice you are missing the parens in your position function - is that just
a mistake in your post?

/A/b[position()=2]/c

Scott Colestock
www.traceofthought.net


"Yossi Dahan" <yossi.dahan@sabratech.co.uk> wrote in message
news:%23cH2yB0lFHA.1412@TK2MSFTNGP09.phx.gbl...
> Marvin Smit wrote: 
> Thanks for the answer guys, but I'm still not getting anything, I changed
> my simple [i] to [position=1], but it did not make any difference.
 I've
> tried the string method before I've posted (as you'd expect) and it did
> not make a difference)
>
> The count itself works great, it's just extracting the nodes text that
> doesn't happen.
>
> Yossi Dahan







[ Post a follow-up to this message ]



    Re: xPath question  
Yossi Dahan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-03-05 07:54 AM

Scott Colestock wrote:
> I notice you are missing the parens in your position function - is that ju
st
> a mistake in your post?
>
> /A/b[position()=2]/c
>
> Scott Colestock
> www.traceofthought.net
>
>
> "Yossi Dahan" <yossi.dahan@sabratech.co.uk> wrote in message
> news:%23cH2yB0lFHA.1412@TK2MSFTNGP09.phx.gbl...
> 
>
>
>
I found it. and I'm embarrassed to admit how silly it was.

the xpath was fine I've actually had to re-check, but I did use
position() properly.

What I didn't do is actually pass the message as a parameter to the
xpath method. my call was simply - xpath(myXPathString) and not xpath
(myMessage,myXPathString) which is, of course, wrong and totally silly.
I am surprised though that it does compile and execute with no errors.

Thanks for the help guys, but unfortunately there's still no cure for
plain stupidity ;-)


Yossi Dahan





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:06 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register