| Dart Home | PowerTCP Sockets for .NET | Custom Development | Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
| Author | Forum: PowerTCP Sockets for .NET (Secure and Standard) Topic: Send Xml through stream.write |
| cityrock eligur@hotmail.com From: haifa, AL Israel Posts: 3 Member Since: 01/13/04 |
posted January 13, 2004 2:52 PM Hi, I am trying to figure out how I send xmlreader through Stream.Write. Do I need to convert the xml to string before I send it, and then at the client side convert it back to XmlTextReader , or is there a way to send it without conversion. Thanks in advance, Eli |
Alex Gladshtein![]() From: Rome, NY USA Posts: 131 Member Since: 12/27/00 |
posted January 13, 2004 3:42 PM Hello Eli, From my knowledge of XMLReader, the Read functionality is just a mechanism for moving from node to node. You should probably just use Tcp.Send with the string and then populate it on the other side. I am not sure there is a way to just stream the bytes from XMLReader and collect them on the other side natively. I don't recall any XMLReader derived classes that support this. It may be easier to just send the data over node by node, depending on your implementation. Thanks, Alex |
| cityrock eligur@hotmail.com From: haifa, AL Israel Posts: 3 Member Since: 01/13/04 |
posted January 13, 2004 3:45 PM Hi Alex, Thanks for your reply. After killing my brains, I found a simple way to convert XMLREADER data to string and back. So that would be easy enough to use. Again, thank you Eli |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted January 13, 2004 4:04 PM If it's not too much trouble, can you post what the "simple way to convert" was? Just in case someone gets this thread in a future search. If it will take you more than a couple minutes, please don't worry about it! |
| cityrock eligur@hotmail.com From: haifa, AL Israel Posts: 3 Member Since: 01/13/04 |
posted January 14, 2004 2:33 AM Sure, no problem. This is the code I found ,written by Steve Livington, which converts ALL xmlreader data to one string : System.Xml.XmlReader xr = cmd.ExecuteXmlReader(); xr.Read(); StringBuilder sb = new StringBuilder(); string cur=""; while ((cur=xr.ReadOuterXml()) != "") sb.Append(cur); XmlDocument doc = new XmlDocument(); XmlNode newNode = doc.CreateNode(XmlNodeType.Element, "root",""); newNode.InnerXml = sb.ToString(); doc.AppendChild(newNode); return doc.OuterXml; That is it. In order to read it back to XML data, use the XMLTEXTREADER , which takes strings and converts them back to XML. Hope it helps. Eli |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted January 14, 2004 8:51 AM Thanks! |
| Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|