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 VeeWee \Xml \Dom \Locator \Element \children as readChildren ;
2020use function VeeWee \Xml \Writer \Builder \children ;
@@ -37,9 +37,12 @@ public function iso(Context $context): Iso
3737 */
3838 fn (object $ value ): string => $ this ->encodeArray ($ context , $ value ),
3939 /**
40- * @param non-empty-string $value
40+ * @param non-empty-string|Element $value
4141 */
42- fn (string $ value ): object => $ this ->decodeArray ($ context , $ value ),
42+ fn (string |Element $ value ): object => $ this ->decodeArray (
43+ $ context ,
44+ $ value instanceof Element ? $ value : Element::fromString ($ value )
45+ ),
4346 ));
4447 }
4548
@@ -68,13 +71,9 @@ private function encodeArray(Context $context, object $data): string
6871 );
6972 }
7073
71- /**
72- * @param non-empty-string $value
73- */
74- private function decodeArray (Context $ context , string $ value ): object
74+ private function decodeArray (Context $ context , Element $ value ): object
7575 {
76- $ document = Document::fromXmlString ($ value );
77- $ element = $ document ->locateDocumentElement ();
76+ $ element = $ value ->element ();
7877
7978 return (object ) readChildren ($ element )->reduce (
8079 static function (array $ map , DOMElement $ item ) use ($ context ): array {
0 commit comments