File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Publishing contents of an XML document to a topic in JMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Publishing contents of an XML document to a topic in JMS" Watch "Publishing contents of an XML document to a topic in JMS" New topic
Author

Publishing contents of an XML document to a topic in JMS

Arpan Joshi
Greenhorn

Joined: Oct 06, 2005
Posts: 1
Hi all,

I am trying to develop a JMS based messaging system using pub-sub model.
Before my publisher publishes messages it has to parse an XML configuration file which will be as follows:

<consumerConfiguration>
<name>BSA-TimeCard</name>
<topic>Some-Topic</topic>
<JMSProvider>100.100.2.2</JMSProvider>
<destination>BSA.OUTGOING</destination>
<body>
CDATA
</body>
</consumerConfiguration>

Values for all of these elements are required and based on the value of topic element I want to select the topic to publish this message to. In this case the value of topic element in the configuration file is timecard so my topic for this message has to be timecard. Now, the elements till the body elements are all part of my header and I don't want to send the header as part of my message. Once the header information(all header elements are present) is verified (if not I want to throw an exception),
I want to send the CDATA(if not empty) which is the message body as part of my JMS message.

Please help me in solving this problem. I am ok in validating the XML file before send it as a message but verifying the header information and choosing the topic on the basis of the topic element is what I need help with.

Hope this is clear enough.

Thanks

arpan
RNivas
Greenhorn

Joined: Aug 20, 2003
Posts: 8
I think ebml/ebxml can help you out for this
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12676
    
    5
choosing the topic on the basis of the topic element is what I need help with.

Extracting the text content of an element is a basic XML processing task. You will find it covered extensively in the many XML tutorials to be found on the net.
You also need to become familiar with the API that describes the structure of XML documents to be found in the org.w3c.dom package in your JavaDocs.
Start with the org.w3c.dom.Node interface.

RNivas - you need to go make your name compatible with the Javaranch naming policy before a sheriff gets on your case.
Bill


Java Resources at www.wbrogden.com
 
Consider Paul's rocket mass heater.
 
subject: Publishing contents of an XML document to a topic in JMS
 
Similar Threads
trapping html tags in xml element values
Editing dtd file to allow certain elements but not use them in a tree display.
passing Invalid characters within XML tags
XPathAPI.selectSingleNode going up the document on cached element
CDATA and PCDATA