ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
EntityAttributes.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\mdattr;
4 
5 use SAML2\Utils;
8 
16 {
20  const NS = 'urn:oasis:names:tc:SAML:metadata:attribute';
21 
29  public $children;
30 
36  public function __construct(\DOMElement $xml = null)
37  {
38  if ($xml === null) {
39  return;
40  }
41 
42  foreach (Utils::xpQuery($xml, './saml_assertion:Attribute|./saml_assertion:Assertion') as $node) {
43  if ($node->localName === 'Attribute') {
44  $this->children[] = new Attribute($node);
45  } else {
46  $this->children[] = new Chunk($node);
47  }
48  }
49  }
50 
57  public function toXML(\DOMElement $parent)
58  {
59  assert(is_array($this->children));
60 
61  $doc = $parent->ownerDocument;
62 
63  $e = $doc->createElementNS(EntityAttributes::NS, 'mdattr:EntityAttributes');
64  $parent->appendChild($e);
65 
67  foreach ($this->children as $child) {
68  $child->toXML($e);
69  }
70 
71  return $e;
72  }
73 }
const NS
The namespace used for the EntityAttributes extension.
$xml
Definition: metadata.php:240
__construct(\DOMElement $xml=null)
Create a EntityAttributes element.
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191