XmlSchema.Read(FileStream, ValidationCallBack) generates the error of "root element is missing"


  • I have noticed that the following statemen generates the error when an XML file using the schema is read:

    XmlSchema xs = XmlSchema.Read(new FileStream("myschema.xsd", FileMode.Open, FileAccess.Read), ValidationCallBack)
    The following works without any problem:

    XmlSchema xs = XmlSchema.Read(new StreamReader("myschema.xsd"), ValidationCallBack);
    Any idea why?  I am just curious.  It is not a problem.


    Sunday, May 30, 2010 5:22 PM


  • Andre,

    FileStream is derived from Stream so it is supposed to be OK.

    Hi Vitek,

    I am sorry but I am unable to reproduce it now - both methods seem to work fine now. The error disappeared when I changed the reading method. It is possible that I also made some other changes but I cannot recall.  My apology.

    Monday, May 31, 2010 2:08 PM

All replies