XMLをsimplexmlで読み込み/解析しようとしています。問題は結果を返さないことです。私は、エラーがforeach
宣言のどこかにあると思われます。誰にも分かりますか?私は非常に感謝されます!SimpleXMLでのXMLの解析/読解
PHP:
$xml = file_get_contents("test.xml");
$feed = simplexml_load_string($xml);
$namespaces = $feed->getNamespaces(true);
print_r($namespaces);
foreach($feed->children($namespaces['ord']) as $child) {
$orde = $child->orderHeader;
$order = $orde->orderType;
print_r($order);
}
XML:最後にdataPack:
<dat:dataPack version="2.0" id="Usr01" ico="25115308" application="Transformace" note="25115308" xmlns:dat="http://www.stormware.cz/schema/version_2/data.xsd">
<dat:dataPackItem version="2.0" id="Usr01 (001)">
<ord:order version="2.0" xmlns:ord="http://www.stormware.cz/schema/version_2/order.xsd">
<ord:orderHeader xmlns:rsp="http://www.stormware.cz/schema/version_2/response.xsd" xmlns:rdc="http://www.stormware.cz/schema/version_2/documentresponse.xsd" xmlns:typ="http://www.stormware.cz/schema/version_2/type.xsd" xmlns:lst="http://www.stormware.cz/schema/version_2/list.xsd" xmlns:lStk="http://www.stormware.cz/schema/version_2/list_stock.xsd" xmlns:lAdb="http://www.stormware.cz/schema/version_2/list_addBook.xsd" xmlns:acu="http://www.stormware.cz/schema/version_2/accountingunit.xsd" xmlns:inv="http://www.stormware.cz/schema/version_2/invoice.xsd" xmlns:vch="http://www.stormware.cz/schema/version_2/voucher.xsd" xmlns:int="http://www.stormware.cz/schema/version_2/intDoc.xsd" xmlns:stk="http://www.stormware.cz/schema/version_2/stock.xsd" xmlns:ofr="http://www.stormware.cz/schema/version_2/offer.xsd" xmlns:enq="http://www.stormware.cz/schema/version_2/enquiry.xsd" xmlns:vyd="http://www.stormware.cz/schema/version_2/vydejka.xsd" xmlns:pri="http://www.stormware.cz/schema/version_2/prijemka.xsd" xmlns:bal="http://www.stormware.cz/schema/version_2/balance.xsd" xmlns:pre="http://www.stormware.cz/schema/version_2/prevodka.xsd" xmlns:vyr="http://www.stormware.cz/schema/version_2/vyroba.xsd" xmlns:pro="http://www.stormware.cz/schema/version_2/prodejka.xsd" xmlns:con="http://www.stormware.cz/schema/version_2/contract.xsd" xmlns:adb="http://www.stormware.cz/schema/version_2/addressbook.xsd" xmlns:prm="http://www.stormware.cz/schema/version_2/parameter.xsd" xmlns:lCon="http://www.stormware.cz/schema/version_2/list_contract.xsd" xmlns:ctg="http://www.stormware.cz/schema/version_2/category.xsd" xmlns:ipm="http://www.stormware.cz/schema/version_2/intParam.xsd" xmlns:str="http://www.stormware.cz/schema/version_2/storage.xsd" xmlns:idp="http://www.stormware.cz/schema/version_2/individualPrice.xsd" xmlns:sup="http://www.stormware.cz/schema/version_2/supplier.xsd" xmlns:prn="http://www.stormware.cz/schema/version_2/print.xsd" xmlns:act="http://www.stormware.cz/schema/version_2/accountancy.xsd" xmlns:bnk="http://www.stormware.cz/schema/version_2/bank.xsd" xmlns:sto="http://www.stormware.cz/schema/version_2/store.xsd" xmlns:grs="http://www.stormware.cz/schema/version_2/groupStocks.xsd" xmlns:acp="http://www.stormware.cz/schema/version_2/actionPrice.xsd" xmlns:csh="http://www.stormware.cz/schema/version_2/cashRegister.xsd" xmlns:ftr="http://www.stormware.cz/schema/version_2/filter.xsd">
<ord:orderType>receivedOrder</ord:orderType>
<ord:number>
<typ:ids>16BPO</typ:ids>
</ord:number>
<ord:date>2015-07-01</ord:date>
<ord:partnerIdentity>
<typ:address>
<typ:company>primy prodej</typ:company>
<typ:name>Restaurace LAVIČKA</typ:name>
<typ:city>Praha</typ:city>
<typ:street>Seifertova 303/77</typ:street>
<typ:zip>130 00</typ:zip>
<typ:ico>27419932</typ:ico>
<typ:dic>CZ27419932</typ:dic>
</typ:address>
<typ:shipToAddress>
<typ:company></typ:company>
<typ:name></typ:name>
<typ:city></typ:city>
<typ:street></typ:street>
</typ:shipToAddress>
</ord:partnerIdentity>
<ord:myIdentity>
<typ:address>
<typ:company>Front Line </typ:company>
<typ:surname>Dostál</typ:surname>
<typ:name>Richard</typ:name>
<typ:city>Praha 9</typ:city>
<typ:street>Kovářská </typ:street>
<typ:number>4/939</typ:number>
<typ:zip>190 00</typ:zip>
<typ:ico>25115308</typ:ico>
<typ:dic>CZ25115308</typ:dic>
<typ:phone>+420326780469</typ:phone>
<typ:mobilPhone>+420737446403</typ:mobilPhone>
<typ:fax>+420326990087</typ:fax>
<typ:email>[email protected]</typ:email>
<typ:www>www.front-line.cz</typ:www>
</typ:address>
</ord:myIdentity>
<ord:paymentType>
<typ:ids>příkazem</typ:ids>
<typ:paymentType>draft</typ:paymentType>
</ord:paymentType>
<ord:isExecuted>true</ord:isExecuted>
<ord:isDelivered>true</ord:isDelivered>
<ord:isReserved>false</ord:isReserved>
<ord:permamentDocument>false</ord:permamentDocument>
<ord:parameters>
<typ:parameter>
<typ:name>VPrExpres</typ:name>
<typ:booleanValue>false</typ:booleanValue>
</typ:parameter>
</ord:parameters>
</ord:orderHeader>
<ord:orderDetail xmlns:rsp="http://www.stormware.cz/schema/version_2/response.xsd" xmlns:rdc="http://www.stormware.cz/schema/version_2/documentresponse.xsd" xmlns:typ="http://www.stormware.cz/schema/version_2/type.xsd" xmlns:lst="http://www.stormware.cz/schema/version_2/list.xsd" xmlns:lStk="http://www.stormware.cz/schema/version_2/list_stock.xsd" xmlns:lAdb="http://www.stormware.cz/schema/version_2/list_addBook.xsd" xmlns:acu="http://www.stormware.cz/schema/version_2/accountingunit.xsd" xmlns:inv="http://www.stormware.cz/schema/version_2/invoice.xsd" xmlns:vch="http://www.stormware.cz/schema/version_2/voucher.xsd" xmlns:int="http://www.stormware.cz/schema/version_2/intDoc.xsd" xmlns:stk="http://www.stormware.cz/schema/version_2/stock.xsd" xmlns:ofr="http://www.stormware.cz/schema/version_2/offer.xsd" xmlns:enq="http://www.stormware.cz/schema/version_2/enquiry.xsd" xmlns:vyd="http://www.stormware.cz/schema/version_2/vydejka.xsd" xmlns:pri="http://www.stormware.cz/schema/version_2/prijemka.xsd" xmlns:bal="http://www.stormware.cz/schema/version_2/balance.xsd" xmlns:pre="http://www.stormware.cz/schema/version_2/prevodka.xsd" xmlns:vyr="http://www.stormware.cz/schema/version_2/vyroba.xsd" xmlns:pro="http://www.stormware.cz/schema/version_2/prodejka.xsd" xmlns:con="http://www.stormware.cz/schema/version_2/contract.xsd" xmlns:adb="http://www.stormware.cz/schema/version_2/addressbook.xsd" xmlns:prm="http://www.stormware.cz/schema/version_2/parameter.xsd" xmlns:lCon="http://www.stormware.cz/schema/version_2/list_contract.xsd" xmlns:ctg="http://www.stormware.cz/schema/version_2/category.xsd" xmlns:ipm="http://www.stormware.cz/schema/version_2/intParam.xsd" xmlns:str="http://www.stormware.cz/schema/version_2/storage.xsd" xmlns:idp="http://www.stormware.cz/schema/version_2/individualPrice.xsd" xmlns:sup="http://www.stormware.cz/schema/version_2/supplier.xsd" xmlns:prn="http://www.stormware.cz/schema/version_2/print.xsd" xmlns:act="http://www.stormware.cz/schema/version_2/accountancy.xsd" xmlns:bnk="http://www.stormware.cz/schema/version_2/bank.xsd" xmlns:sto="http://www.stormware.cz/schema/version_2/store.xsd" xmlns:grs="http://www.stormware.cz/schema/version_2/groupStocks.xsd" xmlns:acp="http://www.stormware.cz/schema/version_2/actionPrice.xsd" xmlns:csh="http://www.stormware.cz/schema/version_2/cashRegister.xsd" xmlns:ftr="http://www.stormware.cz/schema/version_2/filter.xsd">
<ord:orderItem>
<ord:text>Western Guacamole 2 kg</ord:text>
<ord:quantity>2.0</ord:quantity>
<ord:delivered>2.0</ord:delivered>
<ord:unit>ks</ord:unit>
<ord:coefficient>1.0</ord:coefficient>
<ord:payVAT>false</ord:payVAT>
<ord:rateVAT>low</ord:rateVAT>
<ord:discountPercentage>0.0</ord:discountPercentage>
<ord:homeCurrency>
<typ:unitPrice>425.92</typ:unitPrice>
<typ:price>851.84</typ:price>
<typ:priceVAT>127.78</typ:priceVAT>
<typ:priceSum>979.62</typ:priceSum>
</ord:homeCurrency>
<ord:note>acompaňar</ord:note>
<ord:code>900143</ord:code>
<ord:stockItem>
<typ:store>
<typ:ids>MOCHOV</typ:ids>
</typ:store>
<typ:stockItem>
<typ:ids>900143</typ:ids>
<typ:EAN>8717154056709</typ:EAN>
</typ:stockItem>
</ord:stockItem>
</ord:orderItem>
<ord:orderItem>
<ord:text>Tomato Chili Wrap 10"</ord:text>
<ord:quantity>100.0</ord:quantity>
<ord:delivered>100.0</ord:delivered>
<ord:unit>ks</ord:unit>
<ord:coefficient>1.0</ord:coefficient>
<ord:payVAT>false</ord:payVAT>
<ord:rateVAT>low</ord:rateVAT>
<ord:discountPercentage>0.0</ord:discountPercentage>
<ord:homeCurrency>
<typ:unitPrice>5.22</typ:unitPrice>
<typ:price>522</typ:price>
<typ:priceVAT>78.3</typ:priceVAT>
<typ:priceSum>600.3</typ:priceSum>
</ord:homeCurrency>
<ord:note>tortillas</ord:note>
<ord:code>F500230T</ord:code>
<ord:stockItem>
<typ:store>
<typ:ids>MOCHOV</typ:ids>
</typ:store>
<typ:stockItem>
<typ:ids>F500230T</typ:ids>
<typ:EAN>8594053682457</typ:EAN>
</typ:stockItem>
</ord:stockItem>
</ord:orderItem>
</ord:orderDetail>
<ord:orderSummary xmlns:rsp="http://www.stormware.cz/schema/version_2/response.xsd" xmlns:rdc="http://www.stormware.cz/schema/version_2/documentresponse.xsd" xmlns:typ="http://www.stormware.cz/schema/version_2/type.xsd" xmlns:lst="http://www.stormware.cz/schema/version_2/list.xsd" xmlns:lStk="http://www.stormware.cz/schema/version_2/list_stock.xsd" xmlns:lAdb="http://www.stormware.cz/schema/version_2/list_addBook.xsd" xmlns:acu="http://www.stormware.cz/schema/version_2/accountingunit.xsd" xmlns:inv="http://www.stormware.cz/schema/version_2/invoice.xsd" xmlns:vch="http://www.stormware.cz/schema/version_2/voucher.xsd" xmlns:int="http://www.stormware.cz/schema/version_2/intDoc.xsd" xmlns:stk="http://www.stormware.cz/schema/version_2/stock.xsd" xmlns:ofr="http://www.stormware.cz/schema/version_2/offer.xsd" xmlns:enq="http://www.stormware.cz/schema/version_2/enquiry.xsd" xmlns:vyd="http://www.stormware.cz/schema/version_2/vydejka.xsd" xmlns:pri="http://www.stormware.cz/schema/version_2/prijemka.xsd" xmlns:bal="http://www.stormware.cz/schema/version_2/balance.xsd" xmlns:pre="http://www.stormware.cz/schema/version_2/prevodka.xsd" xmlns:vyr="http://www.stormware.cz/schema/version_2/vyroba.xsd" xmlns:pro="http://www.stormware.cz/schema/version_2/prodejka.xsd" xmlns:con="http://www.stormware.cz/schema/version_2/contract.xsd" xmlns:adb="http://www.stormware.cz/schema/version_2/addressbook.xsd" xmlns:prm="http://www.stormware.cz/schema/version_2/parameter.xsd" xmlns:lCon="http://www.stormware.cz/schema/version_2/list_contract.xsd" xmlns:ctg="http://www.stormware.cz/schema/version_2/category.xsd" xmlns:ipm="http://www.stormware.cz/schema/version_2/intParam.xsd" xmlns:str="http://www.stormware.cz/schema/version_2/storage.xsd" xmlns:idp="http://www.stormware.cz/schema/version_2/individualPrice.xsd" xmlns:sup="http://www.stormware.cz/schema/version_2/supplier.xsd" xmlns:prn="http://www.stormware.cz/schema/version_2/print.xsd" xmlns:act="http://www.stormware.cz/schema/version_2/accountancy.xsd" xmlns:bnk="http://www.stormware.cz/schema/version_2/bank.xsd" xmlns:sto="http://www.stormware.cz/schema/version_2/store.xsd" xmlns:grs="http://www.stormware.cz/schema/version_2/groupStocks.xsd" xmlns:acp="http://www.stormware.cz/schema/version_2/actionPrice.xsd" xmlns:csh="http://www.stormware.cz/schema/version_2/cashRegister.xsd" xmlns:ftr="http://www.stormware.cz/schema/version_2/filter.xsd">
<ord:roundingDocument>math2one</ord:roundingDocument>
<ord:roundingVAT>none</ord:roundingVAT>
<ord:homeCurrency>
<typ:priceNone>0</typ:priceNone>
<typ:priceLow>1373.84</typ:priceLow>
<typ:priceLowVAT>206.08</typ:priceLowVAT>
<typ:priceLowSum>1579.92</typ:priceLowSum>
<typ:priceHigh>0</typ:priceHigh>
<typ:priceHighVAT>0</typ:priceHighVAT>
<typ:priceHighSum>0</typ:priceHighSum>
<typ:price3>0</typ:price3>
<typ:price3VAT>0</typ:price3VAT>
<typ:price3Sum>0</typ:price3Sum>
<typ:round>
<typ:priceRound>0.08</typ:priceRound>
</typ:round>
</ord:homeCurrency>
</ord:orderSummary>
</ord:order>
</dat:dataPackItem>
「の問題がどこにあるか私は本当に知りません」。問題を説明してもらえますか?さもなければ誰も_what_が知っているでしょう。 – ADyson
問題は結果が返ってこないということです。 – Venon