1

SimpleXMLElement() を使用して次の xml コードを生成しようとしています:

<WebOrders xmlns="http://microsoft.com/wsdl/types/"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">

しかし、そのようなコード

$webOrders = new SimpleXMLElement('<WebOrders/>');
$webOrders->addAttribute('xmlns', 'http://microsoft.com/wsdl/types/');
$webOrders->addAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$webOrders->addAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');

作ります

<WebOrders xsi="http://www.w3.org/2001/XMLSchema-instance" xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://microsoft.com/wsdl/types/"><WebOrder/><WebOrder/></WebOrders>

それだけ。

4

0 に答える 0