我想创建一个像这样的XML,但我不能这样做..
<content type="application/xml">
<m:properties>
<d:Description>test</d:Description>
<d:IncidentId m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:IncidentId>
<d:ResponsibleContactId m:type="Edm.Boolean" m:null="true" />
我的PHP代码:
$sxe = new SimpleXMLElement('<content></content>');
$prop = $sxe->addChild('m:proprieties');
$prop->addChild('d:Description', 'test');
$prop->addChild('d:IncidentId', '0');
$prop->addChild('d:ResponsibleContactId', '0');
返回此XML,不带前缀m和d:
<content>
<proprieties>
<description>PHP2: More Parser Stories</description>
<incidentid>0</incidentid>
<responsiblecontactid>0</responsiblecontactid>
</proprieties>...
如何设置前缀“m:”和“d:”?感谢