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 » Java XPath with namespace

Post new topic  Reply to topic
 Java XPath with namespace « View previous topic :: View next topic » 
Author Message
MikeOliverAZ
PostPosted: Mon Jul 29, 2013 5:41 pm    Post subject: Java XPath with namespace Reply with quote

Apprentice

Joined: 10 Jul 2013
Posts: 47

I have the following code in a Java Compute Node.

Code:

MbXPath xp = new MbXPath("in:ParameterList/in:StringParameter");
xp.addNamespacePrefix("in", "http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1");
         xp.setDefaultNamespace("http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1");
         
List nodeset = (List)message.evaluateXPath(xp);


nodeset is always empty no matter what I specify, "ListParameter/StringParameter" with the namespace and default namespace or not.

Here is the portion of the xml of the message.

Code:

<in:ParameterList>
      <in:StringParameter       name="CustomerId">639474210070</in:StringParameter>
                 
      <in:StringParameter name="AccessKey">639474210070</in:StringParameter>
                 
      <in:StringParameter name="EventName">flexible</in:StringParameter>



I think I should see a list of three nodes from above example but I don't.

What am I doing wrong?

Ollie
Back to top
View user's profile Send private message Send e-mail
MikeOliverAZ
PostPosted: Mon Jul 29, 2013 6:52 pm    Post subject: Here is the trace Reply with quote

Apprentice

Joined: 10 Jul 2013
Posts: 47

This is the trace showing the message body down to the desired elements we want in our xpath nodeset.

Code:

(0x01000000:Folder):Body    = ( ['xmlnsc' : 0x1e09e80]
      (0x01000000:Folder)http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:CommandRequestData = (
        (0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:in                                    = 'http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1' (CHARACTER)
        (0x01000000:Folder       )http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:Environment = (
          (0x01000000:Folder)http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:Parameter = (
            (0x03000100:Attribute):name  = 'ApplicationDomain' (CHARACTER)
            (0x03000100:Attribute):value = 'CAO_LDM_00' (CHARACTER)
          )
        )
        (0x01000000:Folder       )http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:Command     = (
          (0x01000000:Folder)http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:Operation = (
            (0x03000100:Attribute):namespace                                                            = 'CA' (CHARACTER)
            (0x03000100:Attribute):name                                                                 = 'Recharge' (CHARACTER)
            (0x01000000:Folder   )http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:ParameterList = (
              (0x03000000:PCDataField)http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:StringParameter = '639474210070' (CHARACTER)
              (
                (0x03000100:Attribute):name = 'CustomerId' (CHARACTER)
              )
              (0x03000000:PCDataField)http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:StringParameter = '639474210070' (CHARACTER)
              (
                (0x03000100:Attribute):name = 'AccessKey' (CHARACTER)
              )
              (0x03000000:PCDataField)http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1:StringParameter = 'flexible' (CHARACTER)
              (
                (0x03000100:Attribute):name = 'EventName' (CHARACTER)
              )
             
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Jul 30, 2013 4:19 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I think your path is incomplete:
Code:
List nodeset = (List)message.evaluateXPath(xp);
If 'message' is pointing at the root of the message assembly then the path would need to be something like this ( not tested ):
Code:
/in:CommandRequestData/in:Command/in:Operation/in:ParameterList//in:StringParameter
or else it needs to start with '//' ( if that's allowed ).
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Java XPath with namespace
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.