Many thanks for your reply Martin
The Error I originally got was as follows
When we hit:
While v.Read()
' running through the XML document to ensure validity
End While
An exception is thrown and details as follows
ex.Message = "The root element is missing"
Thanks to your reply by setting the memory stream position to the
beginning
i.e ms.positon=0
My code now seems to pick up the root element
However I now get the two following error messages in the console window
================================================== =========
Validation event\n The 'message' element is not declared an error
occurred at (2,2)
Validation event\n The 'ProductName' element is not declared an error
occurred at (4,3)
================================================== =========
Is this do do with the fact that memoryStream is a binary representation
of the serialised XML? Is this why it does not validate against the
product.xsd
To be honest I havent fully grasped "streams" and the Sytem.IO stuff
Perhaps "ms" should be converted from binary to UTF-8 before being
passed to the
declaration of XmlValidatingReader(New XmlTextReader(ms))
As an aside:
To demonstrate that the MemortStream is binary but does indeeed contain
my serialised object as XML,I have been able to convert the memorystream
(ms) to a byte array using ms.toArray() and then convert that Byte Array
to a String and show the XML i expect out in the console
*** Sent via Developersdex
http://www.developersdex.com ***