Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Help me change this function please.

xmlreader

  • Please log in to reply
1 reply to this topic

#1 hoser2001

hoser2001

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 170 posts

Posted 10 July 2007 - 09:30 AM

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.
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();
            }

  • 0

#2 hoser2001

hoser2001

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 170 posts

Posted 13 July 2007 - 11:48 AM

Disregard the question, solved the problem myself, I don't think I was very descriptive with my problem anyway, but thanks to all those who bothered to look at the post.
  • 0





Also tagged with one or more of these keywords: xmlreader

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download