Posted: Tue Apr 29, 2003 3:30 pm Post subject: Reading file with XML tags and sending it to MQSeries Queue
Newbie
Joined: 28 Apr 2003 Posts: 1 Location: Salt Lake City, UT, USA
Hi All,
I have a requirement like this: -
I have a file with XML tags embedded in it. The MQ Client program that runs on each windows workstation need to read the file and put it as a single message into MQSeries Queue. Following is the sample XML layout: -
------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<compliance>
<computer name="XXX" date="04/29/03">
<info>
<detail name="os" value="Win2k" />
<detail name="lastuser" value="XXX" />
<detail name="distname" value="ws-12345" />
</info>
</computer>
</compliance>
------------------------------------------------------------------------------
I am using MQSeries v 5.3.0.2. I know that MQ Integrator can handle XML formatted messages.
My current program reads this file line and line and converts each of this file into a message.
Is there is a way to read this XML file and put as a one message in the queue by using regular MQSeries API's?
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
Prakash:
What you are trying to do is very trivial.
All you have to do is read the file (may be line by line ) and keep concatenating the string. In the end when you are done reading the file put the entire string as an MQ Message.
Maybe like this
String = "";
read file
while more lines in the file
do
String = String + line read from file
read file
done
put String as MQMessage to a queue
And it doesn't matter whether the message is XML or not.
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