2014-04-11 120 views
0

我在使用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> 

回答

1

檢查< /條*>,這應該是< /項目>

0

您發佈的XML是良好的,所以這不是問題。他們可能需要符合特定的DTD或模式,但除非您向我們展示,否則我們無法提供幫助。說明格式的樣本XML是專有的,可能是非正式的符號,所以我們沒有工具來檢查其是否符合規定。

本質上,您的帖子中沒有任何信息可以幫助我們。