2012-03-06 23 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

相关问题