Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - validating XML with XmlValidatingReader against schema that use xs:include >Thread Next - Re: validating XML with XmlValidatingReader against schema that use xs:include Re: validating XML with XmlValidatingReader against schema that use xs:includeTo: NULL Date: 4/3/2005 2:29:00 PM davidmcb@p... wrote: > The problem is that when I try to do that, the validator is no longer > able to find the type definitions contained in the included schema, > even though the schema are all in the same directory. Another point is > that I want to avoid hardcoding the schema or passing the schema as an > argument to the validator. I just want to pass in the XML document > filename, then use the references to the schema found in the XML > document itself. > > My code is pretty standard: > > XmlTextReader xml = new XmlTextReader(filename); > XmlValidatingReader xsd = new XmlValidatingReader(xml); > xsd.ValidationEventHandler += new > ValidationEventHandler(MyValidationEventHandler); Try explicitly setting a resolver e.g xsd.XmlResolver = new XmlUrlResolver(); see also the documentation <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlValidatingReaderClassXmlResolverTopic.asp> -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
