How to send/receive XmlDocument objects via a message queue?

The XmlDocument object already includes the messages i want to send in xml format. So i dont need to use the XmlMessageFormatter to serialize the object into xml format? How could i send the XmlDocument object via a message queue? Do I need to serialzie it in another way? Thanks a lot!
heyday2004Asked:
Who is Participating?
 
NipNFriar_TuckCommented:
Well if you were trying to send a class then yes... However, you are sending a string.... The doc.OuterXml serializes the XmlDocument into a string with xml tags.  The doc.LoadXml(xmlStr) then puts that string back into an xml document.  Now if you wanted to send a class then you would want to serialize that and the options that you have there are to serialize to a binary string or xml string and either can be sent via MSMQ.  Anyhow this is how I am currently doing this...
0
 
NipNFriar_TuckCommented:
Actually you could send as text like...

XmlDocument doc = your xml Document.
doc.OuterXml

that will give you the complete string representation of the XmlDoc.  Then when you get the string on the other side you can do

string xmlStr = string from MSMQ
XmlDocument doc = new XmlDocument();
doc.LoadXml( xmlStr )


HTH
0
 
heyday2004Author Commented:
Thanks. Do I need to serialize the class? Isn't it a must that every class sent to the queue must be Serializable? Actually, I really don't quite understand serialization here. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.