public XmlSchemaValidator(XmlNameTable nameTable, XmlSchemaSet schemas, IXmlNamespaceResolver namespaceResolver, XmlSchemaValidationFlags validationFlags) { if (nameTable == null) { throw new ArgumentNullException("nameTable"); } if (schemas == null) { throw new ArgumentNullException("schemas"); } if (namespaceResolver == null) { throw new ArgumentNullException("namespaceResolver"); } this.nameTable = nameTable; this.nsResolver = namespaceResolver; this.validationFlags = validationFlags; if (((validationFlags & XmlSchemaValidationFlags.ProcessInlineSchema) != XmlSchemaValidationFlags.None) || ((validationFlags & XmlSchemaValidationFlags.ProcessSchemaLocation) != XmlSchemaValidationFlags.None)) { this.schemaSet = new XmlSchemaSet(nameTable); this.schemaSet.ValidationEventHandler += schemas.GetEventHandler(); this.schemaSet.CompilationSettings = schemas.CompilationSettings; this.schemaSet.XmlResolver = schemas.GetResolver(); this.schemaSet.Add(schemas); this.validatedNamespaces = new Hashtable(); } else { this.schemaSet = schemas; } this.Init(); }
public XmlSchemaValidator(XmlNameTable nameTable, XmlSchemaSet schemas, IXmlNamespaceResolver namespaceResolver, XmlSchemaValidationFlags validationFlags) { if (nameTable == null) { throw new ArgumentNullException("nameTable"); } if (schemas == null) { throw new ArgumentNullException("schemas"); } if (namespaceResolver == null) { throw new ArgumentNullException("namespaceResolver"); } this.nameTable = nameTable; this.nsResolver = namespaceResolver; this.validationFlags = validationFlags; if ( ((validationFlags & XmlSchemaValidationFlags.ProcessInlineSchema) != 0) || ((validationFlags & XmlSchemaValidationFlags.ProcessSchemaLocation) != 0) ) { //Process schema hints in xml document, hence user's set might change this.schemaSet = new XmlSchemaSet(nameTable); this.schemaSet.ValidationEventHandler += schemas.GetEventHandler(); this.schemaSet.CompilationSettings = schemas.CompilationSettings; this.schemaSet.XmlResolver = schemas.GetResolver(); this.schemaSet.Add(schemas); validatedNamespaces = new Hashtable(); } else { //Use the same set from the user this.schemaSet = schemas; } Init(); }