Reading XML messages from MQ...

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Fon Silvers
Participant
Posts: 5
Joined: Wed Jan 24, 2007 10:31 am

Reading XML messages from MQ...

Post by Fon Silvers »

Hi,

We are using MQ and XML for the first time. We have a job which reads the XML messages from MQ using XML input stage and parses the tags based on the xpath mapping and writes to 40 different sequential output files.

The job is running fine with all the defined tags mapped to correct fields in seq files.

We just have a question. What if , we receive a XML tag in the message which is undefined in the path (not mapped to any of 40 files), we want to capture that as a reject file.
For example
<store>123 </store>
<test>test123</test>
Store will be mapped to some output field based on xpath but I do not have mapping for test which I want to go to reject file/column.

In the XML stage , a new seq file was defined as reject file and a column/columns are defined as varchar (1000) for example but no xpath is given since we do not know what tags we expect.
The job is running fine but is not writing any undefined tags to the reject file/reject column. I have some undefined tags in my xml message.

Can anyone help us?


Thanks
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Have an xsd that defines the formal elements....then check for validation..... "new" or "strange" elements will result in a rejection that can be captured down a separate link.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Fon Silvers
Participant
Posts: 5
Joined: Wed Jan 24, 2007 10:31 am

Post by Fon Silvers »

Hi Ernie,
Can you be more specific what is meant by xsd and where I need to define it and how I can specify it in XML stage.

If you mean having all the paths for each column in some kind of file.

I am using a server job.

MQ -> XML input stage - > seq files

Thanks.
Fon Silvers
Systems Analyst/Programmer
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

An "xsd" is an "XML Schema Definition" and there are all kinds of resources out there for you to learn about them, including this site and many books. You would typically get this from the vendor or provider of the XML and is not something you attempt to build yourself... unless, of course, you are supplying XML to someone else.

You don't "specify it in the XML stage" but rather use it to generate the complete metadata you'd need to process the associated XML. In other words, it will get you all possible XPath Expressions needed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Fon Silvers
Participant
Posts: 5
Joined: Wed Jan 24, 2007 10:31 am

Post by Fon Silvers »

Hi,
Thats what I did.

I have all the required xpath expressions in my MQ and XML stage.

And I know I do not get any undefined tags otehr than what I have.

But some of our team members expressed concern what if you get a tag that is not in xpath expression.

The job is running fine but ignoring those tags that are not defined.

I want to capture those undefined tags into teh reject link and column.

But I could not capture those and I cannot define xpath for them since I do not know waht would exist.

Thanks.
Fon Silvers
Systems Analyst/Programmer
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

there is a specification in the root of the document for the name of the xsd. If specified there, and if available to the DataStage engine, you can check the validate box and it will validate the current document against that particular schema..... lookup "xml schema validation" on the web and you will see lots of things that outline how this process works, for DataStage or any other XML parser.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply