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 » Convert XML string (with attributes) to XML

Post new topic  Reply to topic
 Convert XML string (with attributes) to XML « View previous topic :: View next topic » 
Author Message
jpm
PostPosted: Tue Jul 01, 2003 3:40 am    Post subject: Convert XML string (with attributes) to XML Reply with quote

Newbie

Joined: 23 Apr 2003
Posts: 6

Hi,

I have a java plugin node that retrieves an XML string which contains attributes. I assign this XML string to an environment variable, so in MQSI I have something like

Code:
 Environment.Results = '<Tag><Tag1 attr1="value1"><Tag2 attr2="value2"></Tag>'


How do I parse the XML string to build an XML tree structure?

I have tried
Code:
CREATE NEXTSIBLING OF Environment.Results DOMAIN('XML') PARSE(Environment.Results,273,819);


In a trace, this produces something like
Code:
 
(0x3000000)Results   = '<Tag><Tag1 attr1="value1"><Tag2 attr2="value2"></Tag>
(0x1000010)XML       = (
    (0x1000000)Results = (
           (0x1000000)Tag = (
                (0x1000000)Tag1 = (
                       (0x3000000)attr1  = 'value1'

...etc


but how I do reference the results? Environment.XML.Results returns null. Yet, the values are in the trace.

Many thanks,
John
Back to top
View user's profile Send private message
Craig B
PostPosted: Tue Jul 01, 2003 3:55 am    Post subject: Reply with quote

Partisan

Joined: 18 Jun 2003
Posts: 316
Location: UK

Since your data is not in a message tree you have to access the fields themselves to get at your data. So for your example, one way of accessing the data would be by using a field reference such as :

Environment.XML.Results,Tag.Tag1.(XML.Attribute) attr1

to get at the value 'value 1'.

When you referenced then Environment.XML.Results, then depending on what operation you are performing you will either get the subtree it represents or just the value of that single field. If you got a NULL value back the it is likely your operation (such as a CAST) on Environment.XML.Results could only operate on single values. And in this case this field does not have a value itself .... it just has a subtree.
_________________
Regards
Craig
Back to top
View user's profile Send private message
jpm
PostPosted: Tue Jul 01, 2003 5:52 am    Post subject: Reply with quote

Newbie

Joined: 23 Apr 2003
Posts: 6

Thanks for the response.

Is it possible to parse the XML string so that it constructs a message tree?

I am trying to get the XML string in a format or tree structure, that will allow me to use ESQL functions on it. Such as the CARDINALITY() function.
Back to top
View user's profile Send private message
Craig B
PostPosted: Tue Jul 01, 2003 8:30 am    Post subject: Reply with quote

Partisan

Joined: 18 Jun 2003
Posts: 316
Location: UK

In your previous update you showed that your trace looked like the following :

Code:

(0x1000010)XML       = (
    (0x1000000)Results = (
           (0x1000000)Tag = (
                (0x1000000)Tag1 = (
                       (0x3000000)attr1  = 'value1'



That is a parsed XML message tree. Isnt this what you require?
_________________
Regards
Craig
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 » Convert XML string (with attributes) to XML
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.