我在使用XML格式時遇到了一些問題。目前我正在從一個訂單生成這個PHP的XML。但是,當我提交它時,API告訴我我的XML格式無效或格式不正確。XML格式無效
<?xml version="1.0" encoding="iso-8859-1"?>
<orders>
<username>xxxxxxxxx</username>
<password>xxxxxxx</password>
<sandbox>1</sandbox>
<order>
<REFNUM>xxxxx</REFNUM>
<SHIPSETTINGS>
<ITEM>
<VENDOR>ELD</VENDOR>
<VSHIPNATIVE>M02</VSHIPNATIVE>
</ITEM>
</SHIPSETTINGS>
<ORDER_DATE>xx/xx/xxxx</ORDER_DATE>
<PRODUCTS>
<item>
<pnum>xxxxxxxxx</pnum>
<qty>x</qty>
</item>
</PRODUCTS>
<LASTNAME>xxxx</LASTNAME>
<FIRSTNAME>xxxxx</FIRSTNAME>
<ADDRESS1>xxxxxx</ADDRESS1>
<ADDRESS2></ADDRESS2>
<CITY>xxxxxx</CITY>
<STATE>xxxxx</STATE>
<ZIPCODE>xxxxx</ZIPCODE>
<COUNTRY>xx</COUNTRY>
<PHONE1>xxxxxxxxx</PHONE1>
<EMAIL2>xxxxxxx</EMAIL2>
</order>
</orders>
這是XML格式,他們說它需要在英寸我不知道我在做什麼錯了。謝謝你的幫助。對不起,我忘了提及,如果在他們的XML中有一個*,這意味着它是必需的字段。
<?xml version="1.0" encoding="iso-8859-1"?>
<orders>
<username>*username</username>
<password>*password</password>
<sandbox>1</sandbox><-----------Add this parameter to test orders. Api will respond, but no order will be initiated!
<order>
<REFNUM>*dropshippers reference number</REFNUM>
<SHIPSETTINGS>
<ITEM>
<VENDOR>MC</VENDOR>
<VSHIPNATIVE>M02</VSHIPNATIVE>
</ITEM>
<ITEM>
<VENDOR>ELD</VENDOR>
<VSHIPNATIVE>UGR</VSHIPNATIVE>
</ITEM>
</SHIPSETTINGS>
<ORDER_DATE>*5/16/08</ORDER_DATE>
<PRODUCTS>*
<item>*
<pnum>*ABC123</pnum>
<qty>*1</qty>
</item*>
<item>
<pnum>123ABC</pnum>
<qty>3</qty>
</item>
</PRODUCTS>*
<LASTNAME>*Van Riper</LASTNAME> - Customer's shipping info.
<FIRSTNAME>*Erik</FIRSTNAME> - Customer's shipping info.
<COMPANY></COMPANY> - Customer's shipping info.
<ADDRESS1>*4720 Center Ave</ADDRESS1> - Customer's shipping info.
<ADDRESS2>#515</ADDRESS2> - Customer's shipping info.
<CITY>*Wonder City</CITY> - Customer's shipping info.
<STATE>*NY</STATE> - Customer's shipping info.
<ZIPCODE>*11109</ZIPCODE> - Customer's shipping info.
<COUNTRY>*US</COUNTRY> - Customers 2 letter shipping country.
<PHONE1>*(123) 555-1212</PHONE1> - Customer's Shipping phone # 1.
<PHONE2>(555) 555-1212</PHONE2> - Customer's Shipping phone # 2.
<EMAIL1>[email protected]</EMAIL1> - Customer's billing email.
<EMAIL2>*[email protected]</EMAIL2> - Customer's shipping email.
</order>
</orders>