Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   Help me change this function please. (http://www.go4expert.com/forums/help-change-function-t5190/)

rhaazy 10Jul2007 23:01

Help me change this function please.
 
I have a function that accepts two strings (file paths) as inputs. What I need change this function so that it can accept datasets, or something I can pass in memory.
Code:

public void ReadAndValidate(string path2XMLFile, string path2XSDFile)
        {
            using (FileStream fs = File.Open(path2XMLFile, FileMode.Open, FileAccess.Read))
            {
                //GS - Create an xml document to hold our xml
                XmlDocument xdoc = new XmlDocument();

                //GS - Create a reader settings, add the schema, set for
                //schema validation and add a validation event handler
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.Schemas.Add(null, path2XSDFile);
                settings.ValidationType = ValidationType.Schema;
                settings.ValidationEventHandler +=
                    new ValidationEventHandler(settings_ValidationEventHandler);

                //GS - Load and validate the xml
                XmlReader reader = XmlReader.Create(fs, settings);
                xdoc.Load(reader);

                //GS - Close the file stream when we’re done
                fs.Close();
            }



All times are GMT +5.5. The time now is 06:06.