public Validate ( |
||
nodeToValidate | ||
return | bool |
public override bool CheckValidity(XmlSchemaSet schemas, ValidationEventHandler validationEventHandler) { XmlDocument source; if (this.source.NodeType == XmlNodeType.Document) { source = (XmlDocument) this.source; } else { source = this.source.OwnerDocument; if (schemas != null) { throw new ArgumentException(Res.GetString("XPathDocument_SchemaSetNotAllowed", (object[]) null)); } } if ((schemas == null) && (source != null)) { schemas = source.Schemas; } if ((schemas == null) || (schemas.Count == 0)) { throw new InvalidOperationException(Res.GetString("XmlDocument_NoSchemaInfo")); } DocumentSchemaValidator validator = new DocumentSchemaValidator(source, schemas, validationEventHandler) { PsviAugmentation = false }; return validator.Validate(this.source); }
public override bool CheckValidity(XmlSchemaSet schemas, ValidationEventHandler validationEventHandler) { XmlDocument ownerDocument; if (source.NodeType == XmlNodeType.Document) { ownerDocument = (XmlDocument)source; } else { ownerDocument = source.OwnerDocument; if (schemas != null) { throw new ArgumentException(Res.GetString(Res.XPathDocument_SchemaSetNotAllowed, null)); } } if (schemas == null && ownerDocument != null) { schemas = ownerDocument.Schemas; } if (schemas == null || schemas.Count == 0) { throw new InvalidOperationException(Res.GetString(Res.XmlDocument_NoSchemaInfo)); } DocumentSchemaValidator validator = new DocumentSchemaValidator(ownerDocument, schemas, validationEventHandler); validator.PsviAugmentation = false; return validator.Validate(source); }
public void Validate(ValidationEventHandler validationEventHandler, XmlNode nodeToValidate) { if (this.schemas == null || this.schemas.Count == 0) { //Should we error throw new InvalidOperationException(Res.GetString(Res.XmlDocument_NoSchemaInfo)); } XmlDocument parentDocument = nodeToValidate.Document; if (parentDocument != this) { throw new ArgumentException(Res.GetString(Res.XmlDocument_NodeNotFromDocument, "nodeToValidate")); } if (nodeToValidate == this) { reportValidity = false; } DocumentSchemaValidator validator = new DocumentSchemaValidator(this, schemas, validationEventHandler); validator.Validate(nodeToValidate); if (nodeToValidate == this) { reportValidity = true; } }
public void Validate(ValidationEventHandler validationEventHandler, XmlNode nodeToValidate) { if (_schemas == null || _schemas.Count == 0) { //Should we error throw new InvalidOperationException(SR.XmlDocument_NoSchemaInfo); } XmlDocument parentDocument = nodeToValidate.Document; if (parentDocument != this) { throw new ArgumentException(SR.Format(SR.XmlDocument_NodeNotFromDocument, nameof(nodeToValidate))); } if (nodeToValidate == this) { _reportValidity = false; } DocumentSchemaValidator validator = new DocumentSchemaValidator(this, _schemas, validationEventHandler); validator.Validate(nodeToValidate); if (nodeToValidate == this) { _reportValidity = true; } }