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 » Removing/adding an XML tag....

Post new topic  Reply to topic
 Removing/adding an XML tag.... « View previous topic :: View next topic » 
Author Message
klabran
PostPosted: Tue Mar 02, 2004 1:13 pm    Post subject: Removing/adding an XML tag.... Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

<Citation>
<Person>
<PersonRow>
<LName/>
<FName/>
</PersonRow>
</Person>
<VehicleColor/>
<VehicleYear/>
</Citation>

I would like to remove Just the PersonRow Tag so that it looks like

<Citation>
<Person>
<LName/>
<FName/>
</Person>
<VehicleColor/>
<VehicleYear/>
</Citation>

How do I do this?

On a similar note:

How do I add an element called VehicleInfo so that the XML looks like:


<Citation>
<Person>
<LName/>
<FName/>
</Person>
<VehicleInfo>
<VehicleColor/>
<VehicleYear/>
</VehicleInfo>
</Citation>

Lastly, How would I change the tag name of VehicleColor to say VColor?

Thanks,

Kevin
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Mar 02, 2004 1:18 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can make these changes one field at a time, by writing individual SET statements that will populate an otherwise empty OutputRoot.XML.

Or you could read about the MOVE, INSERT, and DELETE functions.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Mar 02, 2004 2:44 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Jeff,

Thanks for the pointers....

I don't seem to have any info on Delete and insert other than the references to DB inserts and deletes.

I am using MQSI 2.1 CSD06.

I tried doing: SET OutputRoot.XML.Citation.PERSON.PERSONROW = NULL;
to remove personrow and nothing changed?

Kevin
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Mar 02, 2004 3:15 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

All of the Database functions work just fine on message trees as well as databases.

That is, you can do Select, Delete, Insert, and Update on OutputRoot.XML as well as on Database.TABLENAME. There are plenty of examples for this in the Programming Guide and the ESQL Reference.

How are you measuring changes, to know that SET OutputRoot.XML.Citation.PERSON.PERSONROW = NULL didn't change anything? That is, are you looking at your message on the queue, or in a trace file, or what?

And there's a difference between setting the VALUE of an element to NULL and setting the Element to NULL.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Mar 02, 2004 3:31 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

I was looking at the resultant message.

I was thinking that setting personrow = null would delete the tag but it didn't.

Nevermind.... It didn't do anything because my XML shows person_row....
HA!

Sorry about that!
Back to top
View user's profile Send private message Visit poster's website
klabran
PostPosted: Wed Mar 03, 2004 8:53 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Jeff,

I am trying to use the Select to copy my Charge row tree but it appears my query is returning null. What am I doing wrong?

SET OutputRoot.XML.Citation.CHARGES.CHARGE[]=(SELECT R.* FROM InputBody.Citations.Citation[I].CHARGES.CHARGE_ROW[] AS R);

Thanks,

Kevin
Back to top
View user's profile Send private message Visit poster's website
klabran
PostPosted: Wed Mar 03, 2004 12:42 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

I figured out how to move/copy and delete tree info using the below SQL...

Maybe not the best way to do it but it works for a newbie like me.

SET OutputRoot.XML.Citation.Charges.Charge[]=(SELECT R.ChargePrefix,R.ChargeCode FROM InputBody.Citations.Citation[I].Charges.Charges_ROW[] AS R);

The below statement removes the Charges_ROW tree altogether by returning null since I am using a bogus InputBody Tree (DoesNotExist)...

SET OutputRoot.XML.Citation.Charges.Charges_ROW[] = (SELECT R.* FROM InputBody.DoesNotExist[] AS R);

For some reason the below didn't work...? (Error - can't assign non list to list)
SET OutputRoot.XML.Citation.Charges.Charges_ROW[] = NULL;

Kevin
Back to top
View user's profile Send private message Visit poster's website
wooda
PostPosted: Fri Mar 05, 2004 2:11 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2003
Posts: 265
Location: UK

Quote:
For some reason the below didn't work...? (Error - can't assign non list to list)
SET OutputRoot.XML.Citation.Charges.Charges_ROW[] = NULL;


The error says it all. OutputRoot.XML.Citation.Charges.Charges_ROW[] refers to all instances of Charge_ROW ie. it's an array. NULL is a constant.

You need to loop here setting each instance of Charges_ROW individually

If there is only ever one instance drop the [].
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 » Removing/adding an XML tag....
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.