本文整理汇总了PHP中SimpleSAML_Utilities::validateXML方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Utilities::validateXML方法的具体用法?PHP SimpleSAML_Utilities::validateXML怎么用?PHP SimpleSAML_Utilities::validateXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSAML_Utilities
的用法示例。
在下文中一共展示了SimpleSAML_Utilities::validateXML方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateXML
public function validateXML()
{
if (!isset($this->metadataXML)) {
throw new Exception('Metadata not available.');
}
$doc = new DOMDocument();
$res = $doc->loadXML($this->metadataXML);
if ($res !== TRUE) {
throw new Exception('Failed to parse Metadata XML: ' . $this->metadataXML);
}
# echo '<pre>'; print_r($res);
$val = SimpleSAML_Utilities::validateXML($doc, 'saml-schema-metadata-2.0.xsd');
if ($val) {
$this->setResult(sspmod_fedlab_Tester::STATUS_FATAL, 'metadata', 'metadata_schemavalid', 'Metadata MUST be schema valid', $val);
} else {
$this->setResult(sspmod_fedlab_Tester::STATUS_OK, 'metadata', 'metadata_schemavalid', 'Metadata MUST be schema valid');
}
}
示例2:
}
$metadata = $doc->firstChild;
/* Check that the metadata is an EntityDescriptor */
if (!SimpleSAML_Utilities::isDOMElementOfType($metadata, 'EntityDescriptor', '@md')) {
$t->data['status'] = 'notentitydescriptor';
$t->show();
exit;
}
/* Check that the entity id of the metadata matches the URL. */
$entityId = $metadata->getAttribute('entityID');
if ($entityId !== $url) {
$t->data['status'] = 'entityid';
$t->data['errortext'] = 'Entity id: ' . $entityId . "\n" . 'URL: ' . $url . "\n";
$t->show();
exit;
}
/* Validate the metadata against the metadata schema (if enabled). */
if ($metaConfig->getBoolean('metashare.validateschema')) {
$errors = SimpleSAML_Utilities::validateXML($doc, 'saml-schema-metadata-2.0.xsd');
if ($errors !== '') {
$t->data['status'] = 'validation';
$t->data['errortext'] = $errors;
$t->show();
exit;
}
}
/* Add the metadata to the metadata store. */
$store->addMetadata($metadata);
$t->data['status'] = 'ok';
$t->show();
exit;