xml
문서를 구문 분석/읽는 중 잘못 알고 있습니다. 내 생각 엔 표준화되지 않았기 때문에 문자열에서 아무 것도 읽지 않으려면 다른 프로세스가 필요합니다.PHP - 구문 분석, XML 읽기
그렇다면 나는 누군가가 xml을 읽는 방법을 배우는 데 오히려 기뻐합니다. 다음은 내가 가지고있는 것과 내가하고있는 것입니다.
example.xml 내가 다시 print_r
에서 어떤 결과를 얻기없는거야
<?php
$content = 'example.xml';
$string = file_get_contents($content);
$xml = simplexml_load_string($string);
print_r($xml);
?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="someurl.php"?>
<response>
<status>Error</status>
<error>The error message I need to extract, if the status says Error</error>
</response>
read_xml.php.
내가 좋아하는 뭔가 더 표준에 xml
전환 :
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
... 그리고 그것을 잘 작동했다. 그래서 비표준 형식 때문일 거라고 확신합니다. 원본에서 되돌려 보겠습니다.
<status>
및 <error>
태그를 어떻게 추출합니까?