This is a new question from Getting anwser from Jabber Server
You’re not going to be successful thinking of the XML you receive like
a file, which is where your Unexpected end of file has occurred error
is coming from. You must parse the XML incrementally.
Ok my question is how? How can I send not closed pice of xml?
Should I serializ object and then send?
BTW. I can’t use existing lib because there isn’t at Windows Phone 7.5.
Let me elaborate on the explanation with an example (with snippets taken from here).
When you connect to an XMPP, you open a connection to the server. To do this, you send something like the following…
…let’s ignore authentication for the moment and just assume that this works. You’ll notice that this one section alone is not valid XML (the element is not closed). However, for XMPP, that’s okay. The server will send back it’s own messages to tell you that you’re good to go. Now we know that we can send our message stanzas. We type out our message, then send…
After a few seconds, we decide to go offline…
Now let’s look at what we sent…
So, in the end, you can think of the interaction with the server as if you are creating a document that EVENTUALLY becomes a fully valid XML document. And this is a nice way to think about things when you’re first learning about XMPP.
However, you’re creating this document over a period of time, not all at once. XML libraries typically don’t think that you’re only going to create PART of the document now: they’re concerned with creating the entire document at once. This is why traditional XML libraries may not be helpful for you in writing XMPP programs. Additionally, a simple XML library won’t be able to deal with extra information such as authentication logic.
In the end, you COULD write your own library. However, you would need to be very careful in your selection of tools (as like I said before, XML libraries might not be able to handle these partial XML creations).
Anyway, in the end, your question is…
How can I send not closed pice of xml?And the answer is: find a library to do it for you. And I don’t mean just the XML parts: I mean all of XMPP. The right library will not even need you to concern yourself with the fact that XML even exists unless you get really advanced. If you can’t find a library…