string pubcommand = "CHAT|" + clientname +": "+ChatOut.Text + "\r\n";
Byte[] outbytes = System.Text.Encoding.ASCII.GetBytes(pubcommand.ToCharArray());
ns.Write(outbytes,0,outbytes.Length);
ChatOut.Text = "";
--------------------------------------------
Byte[] buffer = new Byte[2048];
ns.Read(buffer,0,buffer.Length);
string chatter = System.Text.Encoding.ASCII.GetString(buffer);
string[] tokens = chatter.Split(new Char[]{'|'});
--------------------------------------------
以上2个例子,是用C#写的信息传递,我想问的是,怎么修改为用XML格式传递并且解析
有人告诉我这样写:string pubcommand = <message><note>chat</note><name>clientname</name><text>chatout.text</text></message>
但是编译时候出错了~
请问应该怎么写?
第2个例子的解析XML如何写?在线急等,谢谢大家帮忙。最上面的引用是不是还要加上using.system.xml?麻烦大家帮我写一下,谢谢了~~~
Byte[] outbytes = System.Text.Encoding.ASCII.GetBytes(pubcommand.ToCharArray());
ns.Write(outbytes,0,outbytes.Length);
ChatOut.Text = "";
--------------------------------------------
Byte[] buffer = new Byte[2048];
ns.Read(buffer,0,buffer.Length);
string chatter = System.Text.Encoding.ASCII.GetString(buffer);
string[] tokens = chatter.Split(new Char[]{'|'});
--------------------------------------------
以上2个例子,是用C#写的信息传递,我想问的是,怎么修改为用XML格式传递并且解析
有人告诉我这样写:string pubcommand = <message><note>chat</note><name>clientname</name><text>chatout.text</text></message>
但是编译时候出错了~
请问应该怎么写?
第2个例子的解析XML如何写?在线急等,谢谢大家帮忙。最上面的引用是不是还要加上using.system.xml?麻烦大家帮我写一下,谢谢了~~~
If Not xNodePage Is Nothing Then
Dim xItemNode As System.Xml.XmlNode = xNodePage.SelectSingleNode("Item[@Name='" & strItemName & "']")
If Not xItemNode Is Nothing Then
strRetVal = xItemNode.Attributes("Value").InnerText
End If
End If