99use Soap \Encoding \Encoder \SimpleType \ScalarTypeEncoder ;
1010use Soap \Encoding \Encoder \XmlEncoder ;
1111use Soap \Encoding \TypeInference \XsiTypeDetector ;
12+ use Soap \Encoding \Xml \Node \Element ;
1213use Soap \Encoding \Xml \Reader \ElementValueReader ;
1314use Soap \Encoding \Xml \Writer \XsdTypeXmlElementWriter ;
1415use Soap \Encoding \Xml \Writer \XsiAttributeBuilder ;
1516use Soap \Engine \Metadata \Model \XsdType ;
1617use VeeWee \Reflecta \Iso \Iso ;
17- use VeeWee \Xml \Dom \Document ;
1818use function Psl \Dict \merge ;
1919use function Psl \Type \string ;
2020use function VeeWee \Xml \Dom \Assert \assert_element ;
@@ -39,9 +39,12 @@ public function iso(Context $context): Iso
3939 */
4040 fn (array $ value ): string => $ this ->encodeArray ($ context , $ value ),
4141 /**
42- * @param non-empty-string $value
42+ * @param non-empty-string|Element $value
4343 */
44- fn (string $ value ): array => $ this ->decodeArray ($ context , $ value ),
44+ fn (string |Element $ value ): array => $ this ->decodeArray (
45+ $ context ,
46+ $ value instanceof Element ? $ value : Element::fromString ($ value )
47+ ),
4548 ));
4649 }
4750
@@ -76,14 +79,10 @@ private function encodeArray(Context $context, array $data): string
7679 );
7780 }
7881
79- /**
80- * @param non-empty-string $value
81- */
82- private function decodeArray (Context $ context , string $ value ): array
82+ private function decodeArray (Context $ context , Element $ value ): array
8383 {
84- $ document = Document::fromXmlString ($ value );
85- $ xpath = $ document ->xpath ();
86- $ element = $ document ->locateDocumentElement ();
84+ $ element = $ value ->element ();
85+ $ xpath = $ value ->document ()->xpath ();
8786
8887 return readChildren ($ element )->reduce (
8988 static function (array $ map , DOMElement $ item ) use ($ context , $ xpath ): array {
0 commit comments