LatinCanuck
LatinCanuck

Reputation: 463

XML & MQ best solution

I'm hoping someone here can give me some guidance. I'm working on a project where we use IBM MQ message broker. The project will consist of the following

Receive data from MQ
- MQ will send us records in xml format
- I need to take these xml files & convert them to objets

Send data to MQ
- I need to convert objects to xml format
- I need to send these xml records to MQ

The part I would look some input on is the xml part. I've researched these parsers a bit JAXP, JAXB, JDOM, XOM but being a web developer, its hard to tell which one is better suited for my scenario.

I'm hoping someone with experience on the subject can suggest the best solution.

Thanks

Upvotes: 1

Views: 2932

Answers (2)

Brad
Brad

Reputation: 15879

JAXB is probably the best solution if you have a schema (XSD) defined already. You can generate your Java classes using the xjc.exe commnad line tool and pointing it at your XSD file.

If your XML documents are huge, then you have to consider memory constraints. This post talks about memory issues and JAXB.

If you don't have a schema defined you have more work to do with JAXB, but it is possible according to this post

In short, try to define an XSD and then JAXB is a pinch to use.

On the MQ side of things, I would personally use the Spring framework (supports JAXB) to send/receive/convert MQ messages. Read up about the DefaultMessageListenerContainer in the Spring API (assuming you're going to get your hands dirty in Java). Alternatively you can use Spring Integration, but I haven't personally used that.

Upvotes: 1

kosa
kosa

Reputation: 66637

I guess JAXB fits this purpose and you don't need to any special jars because embedded in framework. XOM may work too, but you need third party libraries.

Upvotes: 1

Related Questions