ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
EntityAttributes.php
Go to the documentation of this file.
1<?php
2
4
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}
An exception for terminatinating execution or to throw for unit testing.
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
const NS
The namespace used for the EntityAttributes extension.
__construct(\DOMElement $xml=null)
Create a EntityAttributes element.