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 » Traversing XML With Default Namespace in JCN using MbXPath

Post new topic  Reply to topic
 Traversing XML With Default Namespace in JCN using MbXPath « View previous topic :: View next topic » 
Author Message
balasai
PostPosted: Wed Sep 20, 2006 12:21 am    Post subject: Traversing XML With Default Namespace in JCN using MbXPath Reply with quote

Newbie

Joined: 13 Dec 2005
Posts: 4

Hi,

We are trying to traverse a XML using MbXPath.The XML Contains Default Namespaces at two different tags.GetLocationInfoResponse & ACORD.We are not able to traverse the Element LocationCode in the xml the broker return empty MBElement.Please suggest if we need to do something different to take care of default namespaces and traverse the XML using MbXPath.

Xml We are trying to traverse using MbXPath
----------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetLocationInfoResponse xmlns="http://www.ffic.com/Agency/AgencyLocationService/">
<ACORD xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.8.0/xml/">
<InsuranceSvcRs>
<AgencyLocationInfoRq>
<LocationCode>6536312</LocationCode>
</AgencyLocationInfoRq>
</InsuranceSvcRs>
</ACORD>
</GetLocationInfoResponse>
</soap:Body>
</soap:Envelope>

Java Code in JCN
--------------------

xp.addNamespacePrefix("xsi", "http://www.w3.org/2001/XMLSchema-instance/");
xp.addNamespacePrefix("xsd", "http://www.w3.org/2001/XMLSchema/");
xp.addNamespacePrefix("soap", "http://schemas.xmlsoap.org/soap/envelope/");
xp.addNamespacePrefix("def","http://www.ffic.com/Agency/AgencyLocationService/");
xp.setDefaultNamespace("http://www.ACORD.org/standards/PC_Surety/ACORD1.8.0/xml");

List chapters = (List)message.evaluateXPath(xp);

MbElement chapter = (MbElement)chapters.get(0); // returns the first chapter
String s1 = chapter.getValue().toString();


Please Suggest How to handle if we have two default Namespace.

Regards
Gayathri
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 » Traversing XML With Default Namespace in JCN using MbXPath
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.