-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathXPath.php
More file actions
37 lines (31 loc) · 1005 Bytes
/
XPath.php
File metadata and controls
37 lines (31 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace SimpleSAML\XMLSecurity\Utils;
use DOMNode;
use DOMXPath;
use SimpleSAML\XMLSecurity\Constants as C;
use SimpleSAML\XPath\XPath as XPathUtils;
/**
* Compilation of utilities for XPath.
*
* @package simplesamlphp/xml-security
*/
class XPath extends XPathUtils
{
/**
* Get a DOMXPath object that can be used to search for XMLDSIG elements.
*
* @param \DOMNode $node The document to associate to the DOMXPath object.
* @param bool $autoregister Whether to auto-register all namespaces used in the document
*
* @return \DOMXPath A DOMXPath object ready to use in the given document, with the XMLDSIG namespace already
* registered.
*/
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
{
$xp = parent::getXPath($node, $autoregister);
$xp->registerNamespace('ds', C::NS_XDSIG);
$xp->registerNamespace('xenc', C::NS_XENC);
return $xp;
}
}