Validate a document tree in memory.
773287
def schemaValidateDoc(self, ctxt):
        
        if ctxt is None: ctxt__o = None
        else: ctxt__o = ctxt._o
        ret = libxml2mod.xmlSchemaValidateDoc(ctxt__o, self._o)
        return ret
491685
def validate_xml(file):
    """"""
    max_file_size = current_app.config.get(
        'PREVIEWER_MAX_FILE_SIZE_BYTES', 1 * 1024 * 1024)
    if file.size > max_file_size:
        return False

    with file.open() as fp:
        try:
            content = fp.read().decode('utf-8')
            xml.dom.minidom.parseString(content)
            return True
        except:
            return False
909699
public void validate(final Node document) throws SchemaValidationException
	{
		try
		{
			final Validator validator = schema.newValidator();

			validator.validate(new DOMSource(document));
		}
		catch (SAXException | IOException e)
		{
			throw new SchemaValidationException(e.getMessage(), e);
		}
	}
1251273
def validate(self):
        """"""
        for context_name in self.context_names:
            context = self.context(context_name)
            try:
                context.validate()
            except ResolvedContextError as e:
                raise SuiteError("Error in context %r: %s"
                                 % (context_name, str(e)))
1106652
function validate(doc, schema, prefix, options) {
  schema.validate(doc, prefix, options);
}
649863
def validate(document, spec):
    """"""
    if not spec:
        return True
    missing = []
    for key, field in spec.iteritems():
        if field.required and key not in document:
            missing.append(key)

    failed = []
    for key, field in spec.iteritems():
        if key in document:
            try: document[key] = field.validate(document[key])
            except ValueError: failed.append(key)

    if missing or failed:
        if missing and not failed:
            raise ValueError("Required fields missing: %s" % (missing))
        if failed and not missing:
            raise ValueError("Keys did not match spec: %s" % (failed))
        raise ValueError("Missing fields: %s, Invalid fields: %s" % (missing, failed))
    # just a token of my kindness, a return for you
    return True
582933
def assert_valid_sdl(document_ast: DocumentNode) -> None:
    

    errors = validate_sdl(document_ast)
    if errors:
        raise TypeError("\n\n".join(error.message for error in errors))
881440
def validate(self, obj):
        """"""
        if self.path:
            for i in self.path:
                obj = obj[i]
        obj = obj[self.field]

        raise NotImplementedError('Validation is not implemented yet')
206244
def _validated(self, data):
        """"""
        errors = []
        for sub in self.schemas:
            try:
                return sub(data)
            except NotValid as ex:
                errors.extend(ex.args)

        raise NotValid(' and '.join(errors))
1234873
def validate(node, source):
  """"""
  # TODO: leaving strict checking off to support insert_grad_of
  lf = LanguageFence(source, strict=False)
  lf.visit(node)
  return node
749007
def validate(self, document):
        ''''''

        template = document.text

        if template not in self.builtin_templates:
            raise ValidationError(
                message=f'Template {template} not found. '
                + f'Available templates are: {", ".join(self.builtin_templates)}.',
                cursor_position=0
            )
296721
private static void validateEntities(org.w3c.dom.Element document, JsonNode entityJson) throws InvalidInputException,
      ProcessingException {
    XPathFactory xPathfactory = XPathFactory.newInstance();
    XPath xpath = xPathfactory.newXPath();

    NodeList nodes;
    try {
      XPathExpression expr = xpath.compile("//@data-entity-id");
      nodes = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
    } catch (XPathExpressionException e) {
      throw new ProcessingException("Internal error processing document tree: " + e.getMessage());
    }

    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      String entityId = ((org.w3c.dom.Attr) node).getValue();

      JsonNode entityNode = entityJson.findPath(entityId);
      if (entityNode.isMissingNode()) {
        throw new InvalidInputException("Error processing EntityJSON: "
            + "no entity data provided for \"data-entity-id\"=\"" + entityId + "\"");
      } else if (!entityNode.isObject()) {
        throw new InvalidInputException("Error processing EntityJSON: "
            + "the node \"" + entityId + "\" has to be an object");
      }
    }
  }
1152868
def _validate(self, inst: "InstanceNode", scope: ValidationScope,
                  ctype: ContentType) -> None:
        """"""
        if (scope.value & ValidationScope.syntax.value and
                inst.value not in self.type):
            raise YangTypeError(inst.json_pointer(), self.type.error_tag,
                                self.type.error_message)
        if (isinstance(self.type, LinkType) and        # referential integrity
                scope.value & ValidationScope.semantics.value and
                self.type.require_instance):
            try:
                tgt = inst._deref()
            except YangsonException:
                tgt = []
            if not tgt:
                raise SemanticError(inst.json_pointer(), "instance-required")
        super()._validate(inst, scope, ctype)
1269801
def validate_collxml(*content_filepaths):
    """"""
    content_filepaths = [Path(path).resolve() for path in content_filepaths]
    return jing(COLLXML_JING_RNG, *content_filepaths)
85371
def validate_is_document_type(option, value):
    """"""
    if not isinstance(value, (abc.MutableMapping, RawBSONDocument)):
        raise TypeError("%s must be an instance of dict, bson.son.SON, "
                        "bson.raw_bson.RawBSONDocument, or "
                        "a type that inherits from "
                        "collections.MutableMapping" % (option,))
1350215
def validate(self):
        
        assert isinstance(self.author, str) , "Assumption Failed: Author is not a string"
        assert isinstance(self.aggregator, str) , "Assumption Failed: Aggregator is not a string"
        assert isinstance(self.provider, str) , "Assumption Failed: Provider is not a string"
        assert isinstance(self.files, list), "Assumption Failed: Files is not a list"
        assert isinstance(self.questions, list), "Assumption Failed: Questions is not a list"
        assert isinstance(self.extra_fields, dict), "Assumption Failed: Extra fields is not a dict"
        return super(TreeNode, self).validate()
564702
def validate(self, text, **kwargs):
        """"""
        cleaned = self.clean(text, **kwargs)
        return cleaned is not None