1

I have a TCP connection wrapped around by SslStream .NET object. The remote server sends spontanous XML messages that I need to receive and parse. I use XmlReader and parse the document manually. I have no schema, I parse the incoming messages one by using XmlReader interface. Is it possible to obtain somehow XmlDocument objects from this XmlStrem?

Regards

cubesoft
  • 3,448
  • 7
  • 49
  • 91
  • I'll repeat my question `Isn't there a separation char between xmls?` as in your previous question http://stackoverflow.com/questions/9088009/xmltextreader-with-sslstream-reading-multiple-xml-from-stream – L.B Feb 10 '12 at 15:24
  • CRLF? What is a separation char that you mean? – cubesoft Feb 10 '12 at 16:01
  • Yes something like CRLF or any other char that only exists between xmls – L.B Feb 10 '12 at 16:07
  • 1
    If there is a special separation char(s), what to do then? – cubesoft Feb 10 '12 at 16:17
  • See this http://stackoverflow.com/questions/8886735/how-to-deserialize-multiple-objects-from-a-json-stream/8887879#8887879 . a CRLF allows to use StreamReader which ,in turn, returns a single line (with each readline)that contains a complete json object. – L.B Feb 10 '12 at 16:51
  • Does not work for me. In xmls I receive there is only "\n" character at the end of the line but the single document may consist of multiple lines so there is not way to distinguish between document using line endings. – cubesoft Feb 15 '12 at 10:42

1 Answers1

1

You may want to look at using XDocument from System.Xml.Linq. Since you already have an XmlReader, you can use the XDocument.Load(XmlReader) method to populate it.

JamieSee
  • 12,696
  • 2
  • 31
  • 47