Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7011229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:06:01+00:00 2026-05-27T22:06:01+00:00

I am working on an application for windows phone 7. I have a to

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:06:01+00:00Added an answer on May 27, 2026 at 10:06 pm

    MemoryStream doesn’t work the way you want it to. When the XmlReader reads to the current end (i.e. consumes all of the current data), it’s going to report that it’s reached end of file.

    What you really need is to wrap a stream around the TCP socket. Probably the easiest thing to do would be to use a TcpClient rather than a raw socket. The GetStream method will do what you want–provide a stream from which you can create an XmlReader.

    Another option is to create a type of stream that does what you’re asking. That is, it lets one thread put data in and another take data out. But the consumer doesn’t report end of file until the producer says end of file has occurred.

    I wrote and published something like this a few months back. See Building a New Type of Stream.

    Honestly, though … TcpClient would be my preference in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on Windows Phone 7 application & was trying to make
Greetings, I'm working in windows application using C#. I have typed-dataset called packetsDBDataSet and
I have been working fine with MVVM Light on a silverlight 4 Windows Phone
I'm working at Windows Phone application these days and have faced the problem with
I am working on Windows Phone 7.1 application. I have a UserControl which has
I am working on a Windows phone 7 application. I am using this implementation
I am working on a Silverlight based Windows Phone application that only supports landscape
I'm trying to get Community.Csharp working with Windows Phone, I've tried using both the
I am working on porting a Windows Phone application to Windows 8 Metro, using
I'm working on a windows phone 7 application which uses Silverlight. What I'm looking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.