일부 d2LogicalModel 마크 업을 사용하는 것으로 보이는 XML 소스가 있는데 PHP의 SimpleXML을 사용하여 XML 데이터를 추출하는 방법을 알아 내려고 정말 고심하고 있습니다.PHP에서 SImpleXML을 통해 XML 데이터에 액세스하는 방법
필자는 아래 XML의 축소판을 포함 시켰습니다. 어떻게 carParkIdentity를 추출합니까? 특정 ID에 액세스하는 방법은 무엇입니까?
그럼 나머지 데이터는 직접 알아낼 수 있습니다!
감사합니다.
<d2lm:d2LogicalModel xmlns:d2lm="http://datex2.eu/schema/1_0/1_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xalan="http://xml.apache.org/xslt" xmlns:java="http://xml.apache.org/xalan/java" modelBaseVersion="1.0" xsi:schemaLocation="http://datex2.eu/schema/1_0/1_0 http://datex2.eu/schema/1_0/1_0/DATEXIISchema_1_0_1_0.xsd">
<d2lm:exchange>...</d2lm:exchange>
<d2lm:payloadPublication lang="en" xsi:type="d2lm:SituationPublication">
<d2lm:situation id="CPN0017">
<d2lm:situationRecord id="CPN0017_1" xsi:type="d2lm:CarParks">
<d2lm:situationRecordCreationTime>2017-01-03T10:47:41</d2lm:situationRecordCreationTime>
<d2lm:situationRecordVersion>1</d2lm:situationRecordVersion>
<d2lm:carParkIdentity>Chapelfield, Chapelfield Road, N:CPN0017</d2lm:carParkIdentity>
<d2lm:carParkOccupancy>77.0</d2lm:carParkOccupancy>
<d2lm:carParkStatus>enoughSpacesAvailable</d2lm:carParkStatus>
</d2lm:situationRecord>
</d2lm:situation>
</d2lm:payloadPublication>
</d2lm:d2LogicalModel>
동일한 제목을 Google에 붙여 넣으려고 했습니까? 그렇다면 붙여 넣기하면 많은 튜토리얼과 답변을 얻을 수 있습니다 .http : //php.net/manual/en/simplexml.examples-basic.php –
그런 다음 모두 실패하면 [매뉴얼 읽기] (http : // php .net/manual/en/simplexml.examples-basic.php) 코드를 작성한 다음 문제가 생기면 다시 돌아 오십시오. – RiggsFolly
SimpleXML에 대한 예제와 설명서를 읽었지만이 기능이 작동하지 않는 것 같습니다. 특정 마크 업, 여기서 나는 어려움을 겪고 있습니다! 어쩌면 질문을 잘못 말한 것일까 요? 기본 수준에서 SimpleXML에 대한 도움이 필요하지 않습니다. 필자는이 특별한 이상한 마크 업에 SimpleXML을 사용하여 도움이 필요합니다. – nomaki