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이
내가 XML 1 생각<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>