Updating XmlValidatingReader

Mark Gregory <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
Hi,

I'm a little confused by the change from XmlValidatingReader to
XmlReader.

I would appreciate a pointer or two on what to do to upgrade this method


public bool Validate()
                {
                        errors.Clear();
                        XmlValidatingReader vr = null;
                        object doc = schemas[0];
                        if ( doc is Stream)
                        {
                                vr = new XmlValidatingReader(
(Stream)doc, XmlNodeType.Element, null );
                        }
                        else if ( doc is String )
                        {
                                vr = new XmlValidatingReader(
(string)doc, XmlNodeType.Element, null );
                        }

                        try
                        {
                                for(int i=1;i<schemas.Count;i++)
                                {
                                        vr.Schemas.Add( null, new
XmlTextReader( (Stream)schemas[i] ) );
                                }

                                vr.ValidationEventHandler += new
System.Xml.Schema.ValidationEventHandler(ValidationEventHandler);
                	
                                while( vr.Read() );
                                return isValid;
                        }
                        finally
                        {
                                vr.Close();
                        }
                }

Regards,
Mark

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.