2012-03-06 29 views
0

我想要一個adf xml文件發佈到crm。PHP的XML創建<?adf version =「1.0」?>標記

到目前爲止,我已經能夠創建此

<?xml version="1.0" encoding="UTF-8"?> 

<adf version="1.0"> 

<prospect> 

但需要創建這個

<?xml version="1.0" encoding="UTF-8" ?> 

    <?adf version="1.0"?> 

     <adf> 

     <prospect> 

我似乎無法找到一個方法來創建標籤。需要幫忙。

我想拿出和ADF xml文件使用PHP DOM的文件應該是這樣的

餘米試圖想出了使用DOM的PHP中如ADF的XML文檔

<?ADF VERSION="1.0"?> 
    <adf> 
     <prospect> 
     <id sequence="uniqueLeadId" source="name of promotion"></id> 
     <requestdate>2008-06-25T8:47:50</requestdate> 
     <vehicle interest="buy" status="used"> 
      <vin>2G4WF52L6S1472882</vin> 
      <year>1995</year> 
      <make>BUICK</make> 
      <model>Regal</model> 
      <stock>12886</stock> 
     </vehicle> 
     <customer> 
      <contact> 
      <name part="first" type="individual">Johnny</name> 
      <name part="last" type="individual">Customer</name> 
      <email>[email protected]</email> 
      <phone type="home">857-485-7485</phone> 
      <phone type="work">867-586-7584</phone> 
      <phone type="mobile">979-685-9685</phone> 
     </contact> 
     <comments>What is your best price?</comments> 
     </customer> 
     <vendor> 
     <contact> 
      <name part="full">Name of lead provider or web-site</name> 
      <email>[email protected]</email> 
      <phone type="business">857-485-7485</phone> 
     </contact> 
     </vendor> 
    </prospect> 
</adf> 

我能夠創建文件只有問題是在xml上創建adf聲明。我只能創建一個元素並分配屬性給它例如

$root = $xmlDoc->appendChild($xmlDoc->createElement("adf")); 

$root->setAttribute("version","1.0"); 
+2

哪裏是你現有的碼? – BoltClock 2012-03-06 01:25:47

+0

請您詳細說明一下嗎?你在做什麼?你有任何錯誤信息? – Carsten 2012-03-06 01:27:19

+0

我試圖想出一個adf xml文檔使用dh在php – mululu 2012-03-06 01:55:15

回答

4
$pi = $xmlDoc->createProcessingInstruction('adf', 'version="1.0"'); 
+0

謝謝你解決了這個問題 – mululu 2012-03-06 02:52:38

+0

隨意標記爲接受的答案。 – 2012-03-06 03:06:22

+0

@GeoffreyMululu:請接受這個答案,以便弗朗西斯獲得信貸。謝謝。 – 2012-04-16 20:47:47

相關問題