ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » xpath jcn

Post new topic  Reply to topic
 xpath jcn « View previous topic :: View next topic » 
Author Message
paustin_ours
PostPosted: Fri Mar 21, 2014 11:05 am    Post subject: xpath jcn Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

i have an input xml that has repeating element
Code:

<test>
<in>...
<in>...
<in>...
.
.
</test>

i tried
Code:

MbElement root = message.getRootElement();
MbElement XML =root.getLastChild();
MbXPath exp = new MbXPath("test/in[2]");
XML.evaluateXPath(exp);


now when i do
Code:

XML.evaluateXPath(exp).toString();


i do see the second entry value of in

but how can i get the value to a String like i would

if i do a getValueAsString()

Since the evaluate returns a obj, i tried casting it to a MBelement
Mb element mbe = (Mbelement) XML.evaluateXPath(exp);
thought i might get the value from that, but that errors out.

any suggestions would be of great help.

thanks.
Back to top
View user's profile Send private message Yahoo Messenger
paustin_ours
PostPosted: Fri Mar 21, 2014 12:28 pm    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

saw an example in the infocenter that the evaluatexpath returns an array list. I put in a list and got the value from there.

that worked.

thanks.
Back to top
View user's profile Send private message Yahoo Messenger
paustin_ours
PostPosted: Sat Mar 22, 2014 6:43 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

Well, i ran into another problem.

I build and envrionment tree

i parse the incoming message and store it in the env tree.

my env tree looks like this

Environemnt
TESTDATA
MRM
(parsed data tree)

Now when i try to reference one of the MRM fields using the evaluateXpath, it is not finding it.

Here is the code
Code:

MbElement env_data = assembly.getGlobalEnvironment().getRootElement
();
MbXPath mbx = new MbXPath("MRM/ORDER_ITEM_NAME");
String xpathvar = env.evaluateXPath(mbx).toString();


String value is [] in debugger

when i do
Code:

MbXPath mbx = new MbXPath("TESTDATA");


it is returning the value in TESTDATA

I have tried just about everything, have tried to to step through and get firstchild, next sibling, getname etc., to confim the tree is actually there and it is there.

Any thoughts? Pls let me know. Thanks.[/code]
Back to top
View user's profile Send private message Yahoo Messenger
paustin_ours
PostPosted: Sat Mar 22, 2014 8:46 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

MbXPath mbx = new MbXPath("MRM/ORDER_ITEM_NAME",env);

recognizes the value. For some reason, i have to specifically do that to make it know thatenv is the root element to start looking for data.

I wonder why. But atleast it is working.

thanks.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » xpath jcn
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.