Validates if the xml has a root element which name is phpdocumentor.

@throws InvalidArgumentException if the root element of the xml is not phpdocumentor.
764291
private function validate(SimpleXMLElement $xml): void
    {
        if ($xml->getName() !== 'phpdocumentor') {
            throw new InvalidArgumentException(
                sprintf('Root element name should be phpdocumentor, %s found', $xml->getName())
            );
        }
    }
551117
public static function isSameDocument($uri, $base_uri): bool
    {
        $uri = self::normalize($uri);
        $base_uri = self::normalize($base_uri);

        return (string) $uri->withFragment($uri instanceof Psr7UriInterface ? '' : null)
            === (string) $base_uri->withFragment($base_uri instanceof Psr7UriInterface ? '' : null);
    }
1035997
protected function validateElement(BaseElement $element) : void
    {
        if ($element instanceof Break_) {
            $this->validateBreak($element);
        } elseif ($element instanceof Phoneme) {
            $this->validatePhoneme($element);
        } elseif ($element instanceof SayAs) {
            $this->validateSayAs($element);
        } elseif ($element instanceof Word) {
            $this->validateWord($element);
        }
    }
703350
public function isValid($value)
    {
        $this->checkDependencies();
        $doc = $this->getDocument($value);
        if (empty($doc->documentElement)) {
            $this->error = 'Invalid XML Document';
            return false;
        }

        $path = $this->pathResolver->getPath($doc);
        if (empty($path) || !file_exists($path)) {
            $this->error = "XSD Path: :'$path' not found";
            return false;
        }

        $valid = $this->schemaValidator->validate($doc, $path);
        $this->error = $valid ? '' : $this->getErrorMessage($this->schemaValidator->getErrors());

        return $valid;
    }
447414
public function validateSchemaVersion($xml)
    {
        libxml_use_internal_errors(true);

        try {
            $theSchema = self::getSchemaVersion($xml);
            $doiXML = new \DOMDocument();
            $doiXML->loadXML($xml);
        } Catch (\Exception $e) {
            $this->validationMessage = $e->getMessage();
            return false;
        }

        $schemaPath = SchemaProvider::getSchema($theSchema);

        // if the schema is not stored locally, lookup on datacite
        if (!is_file($schemaPath)) {
            $schemaPath = 'http://schema.datacite.org/meta' . $theSchema;
        }

        $result = $doiXML->schemaValidate($schemaPath);

        foreach (libxml_get_errors() as $error) {
            $this->validationMessage = $error->message;
        }
        return $result;
    }
757055
private function validateTagName(string $name): void
    {
        if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) {
            throw new \InvalidArgumentException(
                'The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, '
                . 'hyphens and backslashes.'
            );
        }
    }
1118061
public final void validate() {
    this.accept(new TreeVisitor() {
      @Override
      public boolean preVisit(TreeNode node) {
        node.validateInner();
        return true;
      }
    });
  }
588758
public function validateIdentifier()
    {
        if (!$this->isMappedSuperclass) {
            if ($this->isIdGeneratorNone()) {
                $this->determineIdStrategy();
            }

            switch ($this->idGenerator) {
                case self::GENERATOR_TYPE_PARENT:
                    if (!($this->parentMapping && $this->nodename)) {
                        throw MappingException::identifierRequired($this->name, 'parent and nodename');
                    }
                    break;
                case self::GENERATOR_TYPE_AUTO:
                    if (!$this->parentMapping) {
                        throw MappingException::identifierRequired($this->name, 'parent');
                    }
                    break;
                case self::GENERATOR_TYPE_REPOSITORY:
                    if (!$this->customRepositoryClassName) {
                        throw MappingException::repositoryRequired($this->name, $this->customRepositoryClassName);
                    }
                    break;
                default:
                    if (!$this->identifier) {
                        throw MappingException::identifierRequired($this->name, 'identifier');
                    }
                    break;
            }
        }
    }
98672
public boolean validateAgainstXsdFile(String xsdFileName) {
        String xsdContent = new FileFixture().textIn(xsdFileName);
        return new XMLValidator().validateAgainst(content, xsdContent);
    }
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);
		}
	}
1014511
private function validate()
    {
        $required = '';

        $validations = [
            'FirstnameOrLastname',
            'PhoneCellphoneOrEmail',
            'ContactTypeId',
            'BusinessTypeId',
            'SuboriginId',
        ];

        for ($i = 0; $i < count($validations) && empty($required); $i++) {
            $required = $this->{"validate" . $validations[$i]}();
        }

        if (!empty($required)) {
            throw new InvalidArgumentException(
                sprintf('Missing required value: %s.', $required)
            );
        }
    }
649682
public function validateXML($xml)
    {
        $xmlValidator = new XMLValidator();
        $result = $xmlValidator->validateSchemaVersion($xml);
        if ($result === false) {
            $this->setResponse("verbosemessage", $xmlValidator->getValidationMessage());
            return false;
        }
        return true;
    }
1178647
public function validate_element( $element ) {
		$type = gettype( $element );
		$callable = $this->type === 'callable';
		$is_object = 'object' === $type;
		$loose_check = $this->type === 'object';

		// callable must be callable
		if ( $callable && ! is_callable( $element ) ) {
			throw new InvalidArgumentException( 'Item must be callable' );
		}

		// target isn't callable, object must be an instance of target
		if ( ! $loose_check && ! $callable && $is_object && ! is_a( $element, $this->type ) ) {
			throw new InvalidArgumentException( "Item is not type or subtype of $this->type" );
		}

		// a non callable, non object type should match the target string
		if ( ! $callable && ! $is_object && $type !== $this->type ) {
			throw new InvalidArgumentException( "Item is not of type: $this->type" );
		}
	}
311569
public function validateElements(){
		$this->_isValid = true;
		$values = $this->getParams();
		
		$this->recValidateElements($this->_elements, $values);
	}
130472
private function validateDtd()
    {
        $libxmlUseInternalErrors = libxml_use_internal_errors(true);
        $dom = $this->writeXml();

        $secureDtdEntityResolver = new SecureDtdEntityResolver();
        $dtd = $secureDtdEntityResolver->resolveEntity($dom->doctype);


        $systemId = 'data://text/plain;base64,'.base64_encode($dtd);

        $creator = new DOMImplementation;
        $doctype = $creator->createDocumentType(
            static::DOCUMENT_TYPE_QUALIFIED_NAME,
            static::DOCUMENT_TYPE_PUBLIC_ID,
            $systemId
        );
        $new = $creator->createDocument('', '', $doctype);

        $oldNode = $dom->getElementsByTagName(static::DOCUMENT_TYPE_QUALIFIED_NAME)->item(0);
        $newNode = $new->importNode($oldNode, true);
        $new->appendChild($newNode);

        if (!$new->validate()) {
            /** @var LibXMLError[] $errors */
            $errors = libxml_get_errors();
            $errMsgStack = [];
            foreach ($errors as $error) {
                $errMsgStack[] = $error->message;
            }
            $errMsg = implode(" \n", $errMsgStack);

            libxml_use_internal_errors($libxmlUseInternalErrors);
            throw new InvalidDtdSchemaException($errMsg);
        }
        libxml_use_internal_errors($libxmlUseInternalErrors);
    }
155192
public function isValid() : bool
   {

      if ( $this->_support->hasAttribute( $this->_requiredAttributeName ) )
      {
         return true;
      }

      return $this->_support->hasAttribute( $this->_altAttributeName );

   }
508232
public function validate() {

		if ($this->getFieldName() === null) {
			throw new ValidationException("'fieldName' can't be null", 'fieldName', $this);
		}
		if ($this->getSorting() === null) {
			throw new ValidationException("'sorting' can't be null", 'sorting', $this);
		}
	}