|
SonicMQ API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XMLMessage
A XML Message is an extention of the TextMessage and is used to send
a message containing XML text in a java.lang.StringBuffer
.
TextMessage inherits from Message
and adds a text message body.
XMLMessage allows access to the XML text's Document Object Model (DOM).
The inclusion of this message type is based on the fact that XML will likely become a popular mechanism for representing content of all kinds including the content of JMS messages.
When a client receives a XMLMessage, it is in read-only mode. If a
client attempts to write to the message at this point, a
javax.jms.MessageNotWriteableException
is thrown. If clearBody
is
called, the message can now be both read from and written to.
The key issues with this class relate to the fact that the message content
can be accessed via get/setText
or get/setDocument
.
To avoid having to parse the message every time it is set, we want to invoke
the parser (XML to DOM) and the streamer (DOM to XML) as little as possible.
It should also be possible
for a user to set the XML with setText()
directly even if the default
parser might fail for some reason. That is, the sender can setText()
and the receiver can getText()
and no-one knows that the message is
"invalid" XML (as far as the parser is concerned).
It is also possible to use the setDocument
method with any
object that implements org.w3c.dom.Document
even if it is not
created with the default parser.
The following cases will apply to the parsing and streaming of XML and DOM's.
BytesMessage
,
MapMessage
,
Message
,
ObjectMessage
,
StreamMessage
,
TextMessage
,
StringBuffer
Field Summary |
---|
Fields inherited from interface javax.jms.Message |
---|
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE |
Fields inherited from interface javax.jms.Message |
---|
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE |
Method Summary | |
---|---|
org.w3c.dom.Document |
getDocument()
This method will return an org.w3c.dom.Document object created from the XMLMessage contents. |
java.lang.String |
getDocumentBuilderFactory()
Gets the class name for the implementation of JAXP1.1 DocumentBuilderFactory interface. |
org.xml.sax.InputSource |
getSAXInputSource()
This method will return an org.xml.sax.InputSource object created from the XMLMessage contents. |
java.lang.String |
getSAXParserFactory()
Gets the class name for the implementation of JAXP1.1 SAXParserFactory interface. |
boolean |
isNamespaceAware()
Method for checking whether or not the underlying javax.xml.parsers.DocumentBuilderFactory used when getDocument() is called is namespace aware |
void |
setDocument(org.w3c.dom.Document aDoc)
This method accept an org.w3c.dom.Document and stores it
as the internal document for this message. |
void |
setDocumentBuilderFactory(java.lang.String classname)
Sets the class name for the implementation of JAXP1.1 DocumentBuilderFactory interface. |
void |
setNamespaceAware(boolean aware)
Set whether or not the underlying javax.xml.parsers.DocumentBuilderFactory used to generate org.w3c.dom.Document returned by XMLMessage.getDocument() is namespace aware. |
void |
setSAXParserFactory(java.lang.String classname)
Sets the class name for the implementation of JAXP1.1 SAXParserFactory interface. |
Methods inherited from interface progress.message.jclient.Message |
---|
acknowledgeAndForward, acknowledgeAndForward, getBodySize, getChannel, getDestinationProperty, getProperties, hasChannel, isDestinationProperty, setChannel, setChannel, setDestinationProperty |
Methods inherited from interface javax.jms.TextMessage |
---|
getText, setText |
Method Detail |
---|
org.w3c.dom.Document getDocument() throws JMSException
JMSException
- if JMS fails to create this message
due to some internal error.void setDocument(org.w3c.dom.Document aDoc) throws JMSException
org.w3c.dom.Document
and stores it
as the internal document for this message. The message content is emptied
but will be generated when the message is sent.
aDoc
- A standard org.w3c.dom.Document object.
JMSException
- if JMS fails to create this message
due to some internal error.
MessageNotWriteableException
- if message in read-only mode.java.lang.String getDocumentBuilderFactory()
void setDocumentBuilderFactory(java.lang.String classname)
This method cannot be called after any of the DOM-related methods (e.g. getDocument()) has been called on the XMLMessage as these methods automatically force the use of the previously set classname.
classname
- the name of the implementation class.java.lang.String getSAXParserFactory()
void setSAXParserFactory(java.lang.String classname) throws JMSException
This method cannot be called after any of the SAX-related methods (e.g. getSAXInputSource()) has been called on the XMLMessage as these methods automatically force the use of the previously set classname.
classname
- the name of the implementation class.
JMSException
org.xml.sax.InputSource getSAXInputSource() throws JMSException
JMSException
- if JMS fails to create this message
due to some internal error.void setNamespaceAware(boolean aware)
aware
- boolean toggle to enable/disable namespace awarenessboolean isNamespaceAware()
|
SonicMQ API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |