Connecting Tech Pros Worldwide Help | Site Map

Converting XML to byte[]

 
LinkBack Thread Tools Search this Thread
  #1  
Old January 8th, 2009, 10:05 PM
Newbie
 
Join Date: Dec 2008
Posts: 10
Default Converting XML to byte[]

Hi,

I'm writing XML simulator that suppose to be a black box.
Loads xml messages, transforms them into byte[] and sends to the other application via TCP/IP protocol without knowing how the application on the other side is implemented.

I need to convert XML message to byte[] and send it via TCP/IP,
but I can't use serialization, because nobody will do the desirialize on the other side(TCP/IP).
Is there any other way?
I have the xsd.

Example of such xml:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <Msg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="msg.xsd">
  3.    <header>
  4.      <id>7</id>
  5.      <source_address>127.0.0.1</source_address>
  6.    </header>
  7.    <body>
  8.      <location>North</location>
  9.      <report_time>
  10.        <day_of_month>20</day_of_month>
  11.      </report_time>
  12.    </body>
  13. </Msg>
Thanks

Last edited by Dormilich; January 8th, 2009 at 10:09 PM. Reason: added [code] tags
Reply
  #2  
Old January 8th, 2009, 10:14 PM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 32
Posts: 2,208
Default

Quote:
Originally Posted by maya7 View Post
I need to convert XML message to byte[] and send it via TCP/IP, ...
what do you mean by "byte[]"?

regards

after reading the C# thread, it would probably be the best if you know what the message shall look like and use (e.g.) XSLT to convert it to that format.
Reply
  #3  
Old January 9th, 2009, 05:12 AM
skitsanos's Avatar
Newbie
 
Join Date: Jan 2009
Location: Bucharest, Romania
Age: 31
Posts: 3
Default

you can do XML to C# (or VB.NET) "translation" with XSLT, where you generate language code out of your XML message and then you can perform runt-time compilation and execution of your dynamically generated "assembly". pretty easy to do actually.
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.