|
6 | 6 |
|
7 | 7 | use Dom; |
8 | 8 | use SimpleSAML\Assert\Assert; |
| 9 | +use SimpleSAML\SAML11\Constants as C; |
9 | 10 | use SimpleSAML\SAML11\Type\SAMLStringValue; |
10 | 11 | use SimpleSAML\XML\AbstractElement; |
| 12 | +use SimpleSAML\XML\Attribute as XMLAttribute; |
11 | 13 | use SimpleSAML\XML\Chunk; |
12 | 14 | use SimpleSAML\XML\SchemaValidatableElementInterface; |
13 | 15 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
14 | 16 | use SimpleSAML\XMLSchema\Constants as C_XSI; |
15 | 17 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
| 18 | +use SimpleSAML\XMLSchema\Type\AnyURIValue; |
16 | 19 | use SimpleSAML\XMLSchema\Type\IntegerValue; |
17 | 20 | use SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface; |
18 | 21 |
|
@@ -146,21 +149,31 @@ public function toXML(?Dom\Element $parent = null): Dom\Element |
146 | 149 | switch ($type) { |
147 | 150 | case "integer": |
148 | 151 | // make sure that the xs namespace is available in the SubjectConfirmationData |
149 | | - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C_XSI::NS_XSI); |
150 | | - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xs', C_XSI::NS_XS); |
| 152 | + $xsi_attr = new XMLAttribute(C::NS_XMLNS, 'xmlns', 'xsi', AnyURIValue::fromString(C_XSI::NS_XSI)); |
| 153 | + $xsi_attr->toXML($e); |
| 154 | + |
| 155 | + $xs_attr = new XMLAttribute(C::NS_XMLNS, 'xmlns', 'xs', AnyURIValue::fromString(C_XSI::NS_XS)); |
| 156 | + $xs_attr->toXML($e); |
| 157 | + |
151 | 158 | $e->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'xs:integer'); |
152 | 159 | $e->textContent = strval($value); |
153 | 160 | break; |
154 | 161 | case "NULL": |
155 | | - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C_XSI::NS_XSI); |
| 162 | + $xs_attr = new XMLAttribute(C::NS_XMLNS, 'xmlns', 'xs', C_XSI::NS_XS); |
| 163 | + $xs_attr->toXML($e); |
| 164 | + |
156 | 165 | $e->setAttributeNS(C_XSI::NS_XSI, 'xsi:nil', '1'); |
157 | 166 | $e->textContent = ''; |
158 | 167 | break; |
159 | 168 | case "object": |
160 | 169 | if ($value instanceof ValueTypeInterface) { |
161 | 170 | if ($this->value instanceof IntegerValue) { |
162 | | - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C_XSI::NS_XSI); |
163 | | - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xs', C_XSI::NS_XS); |
| 171 | + $xsi_attr = new XMLAttribute(C::NS_XMLNS, 'xmlns', 'xsi', AnyURIValue::fromString(C_XSI::NS_XSI)); |
| 172 | + $xsi_attr->toXML($e); |
| 173 | + |
| 174 | + $xs_attr = new XMLAttribute(C::NS_XMLNS, 'xmlns', 'xs', AnyURIValue::fromString(C_XSI::NS_XS)); |
| 175 | + $xs_attr->toXML($e); |
| 176 | + |
164 | 177 | $e->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'xs:integer'); |
165 | 178 | } |
166 | 179 | $e->textContent = strval($value); |
|
0 commit comments