내가 특정 노드의 제품 이름과 이미지를 검색 할 다음과 같은 XML (ID)PHP의 XPath는 문제 -> 항목 (0) -> nodeValue를
<?xml version="1.0" encoding="utf-8"?>
<clients>
<client id="A">
<product>Name of product A</product>
<image>Product image name A</image>
</client>
<client id="B">
<product>Name of product B</product>
<image>Product image name B</image>
</client>
</clients>
이것은 PHP 코드가 기준 자료 :
Name of product A
Product image name A
하지만 싶어 -> 제품 -
$doc = DOMDocument::load('clients.xml');
$xpath = new DOMXPath($doc);
$query = '//client[@id="A"]';
$info = $xpath->query($query);
나는 $ info-을 할 경우> 항목 (0)> nodeValue를 내가 함께가 아니라 개별적으로 정보를 모두 얻을 수 -> nodeValue 및 image-> nodeValue는 클라이언트 ID를 기반으로합니다. 어떻게하면됩니까? 예를 들어 $ info-> item (0) -> product-> nodeValue가 작동하지 않습니다.
-> 항목 (0) -> nodeValue를