0
このxmlをsoapで生成する必要がありますが、属性を含むネストされたxmlを作成することはできません。属性付きのネストされたsoap xml
私はこの
<ns1:SelectedSupplements>
<ns1:SupplementInfo suppId="16" supTotalPrice="0.00" suppType="4" />
<ns1:SupplementInfo suppId="1000615" supTotalPrice="360.00" suppType="8" />
</ns1:SelectedSupplements>
でもないこの
<ns1:SelectedSupplements>
<ns1:SupplementInfo suppId="16" supTotalPrice="0.00" suppType="4" />
<ns1:SupplementInfo suppId="1000615" supTotalPrice="360.00" suppType="8">
<ns1:SupAgeGroup>
<ns1:SuppAges suppFrom="1" suppTo="7" suppQuantity="1" suppPrice="40.00"/>
<ns1:SuppAges suppFrom="8" suppTo="99" suppQuantity="2" suppPrice="80.00"/>
</ns1:SupAgeGroup>
</ns1:SupplementInfo>
</ns1:SelectedSupplements>
これは、あなたがこれを達成するためのDOMDocument http://php.net/manual/en/class.domdocument.phpを使用することができます最初のXML
$room_class = new stdClass();
$supplement = array();
foreach($results["hotels"]["hotel"][0]["options"]["option"][$key]["fees"]["fee"] as $one_supp)
{
array_push($supplement, array("suppId"=> $one_supp["suppId"] , "supTotalPrice" => $one_supp["amt"] , "suppType" => $one_supp["supptType"]));
}
$room_class->SelectedSupplements = $supplement;
属性を含むネストされたXMLを作成しますが、重複する要素を作成しません。SupplementInfoおよびSuppAges –