0
ファイルからxmlを解析するための基本的な共通ラインがあります。 問題はです。XML 2は正常に解析されますが、XML 1はNULLを返しています。 私はすべてのエラーをチェックし、すべてを調べ、まだ分かりませんでした。一部のXMLではsimplexml_load_fileが動作しません
file_contentsでも試しましたが、まだ動作していません。
$xml =(simplexml_load_file($data, 'SimpleXMLElement', LIBXML_NOCDATA));
XML 1
<?xml version="1.0" encoding="utf-8"?>
<msg:Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msg="urn:xmlns:SSE-HomeServices:Messages:Inbound">
<msg:MessageHeader>
<msg:senderOrgId>Actavo</msg:senderOrgId>
<msg:senderTimeStamp>2017-12-06T09:16:57</msg:senderTimeStamp>
<msg:contractId>CNR-420781-Z7L8Q8</msg:contractId>
</msg:MessageHeader>
<msg:Response>
<msg:WorkOrders>
<msg:WorkOrder>
<msg:woNumber>W00521062</msg:woNumber>
<msg:woNotes>Leak and aav all sorted .
Boiler now operating correctly and no leaks
Sop7 done No combustion affected Visuals done </msg:woNotes>
<msg:isProductSwitchRequired>No</msg:isProductSwitchRequired>
<msg:productSwitchReason xsi:nil="true" />
</msg:WorkOrder>
</msg:WorkOrders>
</msg:Response>
</msg:Message>
XML 2
<Message xmlns="urn:xmlns:SSE-HomeServices:Messages:Outbound" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<MessageHeader>
<senderOrgId>SSE</senderOrgId>
<senderTimeStamp>2017-10-16T15:50:53.2291513+01:00</senderTimeStamp>
</MessageHeader>
<Request>
<WorkOrders>
<WorkOrder>
<woNumber>W00617195</woNumber>
<woCategory>Maintenance</woCategory>
<woGroup>Gas Work</woGroup>
<woType>Same Day Breakdown + Service</woType>
<woInstruction>Cust has no CH or HW. Can an initial inspection be carried out too please. Please can we phone this customer asap due to previous lack of communication. Promotion :N/A Base Product Name :Boiler Cover Addon Product Name :Gas Service Feature Product
Name :N/A Staff :False Landlord :False</woInstruction>
<isCentralHeatingOperational>No</isCentralHeatingOperational>
<isHotWaterOperational>No</isHotWaterOperational>
<isCallOutChargeable>Non Chargeable</isCallOutChargeable>
<isPartsChargeable>Determine on site</isPartsChargeable>
<isLabourChargeable>Determine on site</isLabourChargeable>
<dueDate>2017-10-17T14:49:00Z</dueDate>
<name>Same Day Breakdown + Service workorder for Daniel Ward</name>
<appointmentNumber>1</appointmentNumber>
</WorkOrder>
</WorkOrders>
</Request>
</Message>