Converting XML to byte[]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maya7
    New Member
    • Dec 2008
    • 10

    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:

    Code:
    <?xml version="1.0"?>
    <Msg xmlns:xsi="[URL]http://www.w3.org/2001/XMLSchema-instance[/URL]" xsi:noNamespaceSchemaLocation="msg.xsd">
       <header>
         <id>7</id>
         <source_address>127.0.0.1</source_address>
       </header>
       <body>
         <location>North</location>
         <report_time>
           <day_of_month>20</day_of_month>
         </report_time>
       </body>
    </Msg>
    Thanks
    Last edited by Dormilich; Jan 8 '09, 11:09 PM. Reason: added [code] tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by maya7
    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.

    Comment

    • skitsanos
      New Member
      • Jan 2009
      • 3

      #3
      you can do XML to C# (or VB.NET) "translatio n" 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.

      Comment

      Working...