그동안 야매(?)로 XML을 파싱하고 있었는데, 드디어, 좋은 CLASS를 구했다.
클래스를 아래에서 다운로드 받은 뒤, 인클루드 시키고,
http://www.criticaldevelopment.net/xml/doc.php
<?php
//Get the XML document loaded into a variable
$xml = file_get_contents('example.xml');
//Set up the parser object
$parser = new XMLParser($xml);
//Work the magic...
$parser->Parse();
echo " : ".$parser->document->channel[0]->item[$i]->title[0]->tagName." : ".$parser->document->channel[0]->item[$i]->title[0]->tagData."";
?>
하면 된다.
예제에서는 file_get_contents()로 XML을 요청했는데, 보안문제로 안 될 경우에는 HttpRequest로 부르면 된다.
클래스를 아래에서 다운로드 받은 뒤, 인클루드 시키고,
http://www.criticaldevelopment.net/xml/doc.php
<?php
//Get the XML document loaded into a variable
$xml = file_get_contents('example.xml');
//Set up the parser object
$parser = new XMLParser($xml);
//Work the magic...
$parser->Parse();
echo " : ".$parser->document->channel[0]->item[$i]->title[0]->tagName." : ".$parser->document->channel[0]->item[$i]->title[0]->tagData."";
?>
하면 된다.
예제에서는 file_get_contents()로 XML을 요청했는데, 보안문제로 안 될 경우에는 HttpRequest로 부르면 된다.
댓글 달기