Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
REST web service
Message
Information générale
Forum:
Internet
Catégorie:
Autre
Divers
Thread ID:
01612361
Message ID:
01612377
Vues:
48
That won't work because the stream is read-once. You'll be at the end of the stream.

Viv's idea is the right one - read the stream to a string (or to some other stream like a TextWriter), adjust if needed then use Load() to explicitly load the string... Unless the XML is enormous this is very fast - what's slow is the IO operations of reading the data from the stream over the network.


+++ Rick ---

>public static string getElementValue(string elementName,Stream stream)
> {
> StreamReader reader = new StreamReader(stream);
> string fileInfo = reader.ReadLine();
> XDocument doc = XDocument.Load(stream);
> return (from element in doc.Descendants(elementName)
> select element).Single().Value;
> }
>
>and in debug fileinfo is empty. Would I expect to see a response in there ? Can I access this stream like that ?
>
>Update I changed readline to ReadToEnd and now I can see its returning a web page which is wrong. thats some progress I guess
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform