- PHP
- 2008-01-31 - 更新:2014-05-28
例)
$dom = new domDocument; $dom->load('books.xml'); // XML文書読み込み $root = $dom->documentElement; $books = $root->childNodes; foreach($books as $book) { if(@$book->nodeName == 'book') { $content = $book->childNodes; foreach ($content as $elem) { if(@$elem->nodeName == 'name') { $author = $elem->nodeValue; } if(@$elem->nodeName == 'publish') { $title = $elem->nodeValue; } } } }
1,117 views