I am working on an application for windows phone 7.
I have a to parse xml stream using tcp sockets in c# silverlight. I am trying it using xmlreader and memory stream but it is of no help. When memory stream is updated by a receive async call, xmlreader has no impact of that reader.
Please help me on how to parse streaming xml from sockets.
I have a xmlReader such that:
memoryStream= new MemoryStream();
_xmlreader = XmlReader.Create(memoryStream, xmlReaderSettings, context);
now memoryStream is updated as:
byte []buffer = "initialized with some xml bytes such as <node1> data </node1>"
as this buffer is filled by socket receiveasync operation which is xml. now i need to update the my data. so I do this...
memoryStream = memoryStream.write(buffer,0,buffer.length);
Now when i do this _reader.read fails. I don't why is this happening. otherwise is there is xmlpullparser (sax) like thing as we have in android os for xml parsing
while (_reader.Read())
{
switch (_reader.NodeType)
{
case XmlNodeType.Element:
{
node = new XElement(_reader.Name);
xmlBuildStack.Push(node);
}
break;
case XmlNodeType.EndElement:
.....
is there any other way possible to parse xml which comes from tcp socket stream as i am working on chat application which uses xmpp xml stanzas. please help me in solving this scenario.