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 » Filter the XML

Post new topic  Reply to topic
 Filter the XML « View previous topic :: View next topic » 
Author Message
bugsbunny
PostPosted: Fri Jun 10, 2005 3:45 am    Post subject: Filter the XML Reply with quote

Novice

Joined: 24 Apr 2005
Posts: 11

Hi Everybody

My Scenario is like this

Message Flow:
Input node - FilterNode - Compute Node- Output Node

Sample Message is

<Invoice>
<InvoiceNo>300524</InvoiceNo>
<InvoiceDate>2000-12-07</InvoiceDate>
<InvoiceTime>12:40:00</InvoiceTime>
<TillNumber>3</TillNumber>
<Cashier StaffNo="089">Mary</Cashier>
<Customer>
<FirstName>Andrew</FirstName>
<LastName>Smith</LastName>
<Title>Mr</Title>
<DOB>20-01-70</DOB>
<PhoneHome>01962818000</PhoneHome>
<PhoneWork/>
<Billing>
<Address>14 High Street</Address>
<Address>Hursley Village</Address>
<Address>Hampshire</Address>
<PostCode>SO213JR</PostCode>
</Billing>
</Customer>
<Payment>
<CardType>Visa</CardType>
<CardNo>4921682832258418</CardNo>
<CardName>Mr Andrew J. Smith</CardName>
<Valid>1200</Valid>
<Expires>1101</Expires>
</Payment>
<Purchases>
<Item>
<Title Category="Computer" Form="Paperback" Edition="2">The XML Companion
</Title>
<ISBN>0201674866</ISBN>
<Author>NeilBradl ey</Author>
<Publisher>Addison-Wesley</Publisher>
<PublishDate>October 1999</PublishDate>
<UnitPrice>27.95</UnitPrice>
<Quantity>2</Quantity>
</Item>
<Item>
<Title Category="Computer" Form="Paperback" Edition="2">A Complete Guide
to DB2 UniversalDatabase</Titl e>
<ISBN>1558604820</ISBN>
<Author>Don Chamberlin</Author>
<Publisher>Morgan Kaufmann Publishers</Publisher>
<PublishDate>April 1998</PublishDate>
<UnitPrice>42.95</UnitPrice>
<Quantity>1</Quantity>
</Item>
<Item>
<Title Category="Computer" Form="Hardcover" Edition="0">JAVA 2 Developers
Handbook</Title>
<ISBN>0782121799</ISBN>
<Author>Philip Heller, Simon Roberts </Author>
<Publisher>Sybex, Inc.</Publisher>
<PublishDate>September 1998</PublishDate>
<UnitPrice>59.99</UnitPrice>
<Quantity>1</Quantity>
</Item>
</Purchases>
<StoreRecords/>
<DirectMail/>
<Error/>
</Invoice>

Is it possible to filter the XML and Generate Output XML containing the only
<Invoice>
<InvoiceNo>300524</InvoiceNo>
<InvoiceDate>2000-12-07</InvoiceDate>
<InvoiceTime>12:40:00</InvoiceTime>
<TillNumber>3</TillNumber>
<Cashier StaffNo="089">Mary</Cashier>
<Customer>
<FirstName>Andrew</FirstName>
<LastName>Smith</LastName>
<Title>Mr</Title>
<DOB>20-01-70</DOB>
<PhoneHome>01962818000</PhoneHome>
<PhoneWork/>
<Billing>
<Address>14 High Street</Address>
<Address>Hursley Village</Address>
<Address>Hampshire</Address>
<PostCode>SO213JR</PostCode>
</Billing>
</Customer>
<Payment>
<CardType>Visa</CardType>
<CardNo>4921682832258418</CardNo>
<CardName>Mr Andrew J. Smith</CardName>
<Valid>1200</Valid>
<Expires>1101</Expires>
</Payment>
<Purchases>
<Item>
<Title Category="Computer" Form="Paperback" Edition="2">The XML Companion
</Title>
<ISBN>0201674866</ISBN>
<Author>NeilBradl ey</Author>
<Publisher>Addison-Wesley</Publisher>
<PublishDate>October 1999</PublishDate>
<UnitPrice>27.95</UnitPrice>
<Quantity>2</Quantity>
</Item>
</Purchases>
<StoreRecords/>
<DirectMail/>
<Error/>
</Invoice>
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Fri Jun 10, 2005 3:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can certainly write ESQL code that will copy only the relevant fields from the InputRoot.XML to the OutputRoot.XML in a compute node.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Tibor
PostPosted: Fri Jun 10, 2005 5:12 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

Try something similar (not tested):
Code:
SET OutputRoot.XML = InputRoot.XML;
SET OutputRoot.XML.Invoice.Purchases[] =
  (SELECT I.Item
     FROM InputRoot.XML.Invoice.Purchases.Item[] AS I
     WHERE I.Quantity > 1); /* any filter expression */

Tibor
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 » Filter the 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.