c# - xml issue incorporating byte array -


hello use form of message parsing in write fields buffered stream, , extract byte array repesantaition of stream

mymessage _message = new mymessage("me","you",messagetype.peer_message,4252422) ; // in constructor string sender,string receiver,messagetype(enumaraition) m_type,int32 id   byte [] buffer = myencoder.encode(message) ; 

now when pass mydecoder decodes in same metter , works great ! how not issue

my issue in cases of misscommunicaition need store byte[] array (buffer) farther use , , i'm trying in xmldocumant under tag here in inner text save array of bytes

ive tryed --> utf8encoding.ascii.getstring(buffer) save kind of repsantaition changes values of field wich not strings... when take out using

utf8encoding.ascii.getbytes(packet_node.innertext) ;  

1)the question how u go saving byte array xmlnode 2)i've tried writing fields 1 one in each tag

 <packet>       <sender>me</sender>       <receiver>him</receiver>       <messagetype> ..?? how  represent byte string ? </messagetype>        <id> 4252353523 </id> here have no problem still have prase value , forth in other uses int string ..  </packet>  

3) conclusion serialize byte array xmldocument .. don't want document 1 node in existing document

encode base-64 string. remember decode when read back.

byte[] bytes = ...; string encoded = convert.tobase64string(bytes); byte[] decoded = convert.frombase64string(encoded); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -