Adem Bey, dediğiniz gibi kod çalışıyor fakat sizin örneğinizde XML, php kodu içinde.. ben xml dosyasından okumak istiyorum.
15 Ağustos 2011 17:26 tarihinde Adem Alp YILDIZ <[email protected]> yazdı: > sondaki </xml> etiketini silin > > aşağıdaki örnek çokta güzel çalışıyor. > > <?php > > $xml = <<<EOF > > <?xml version="1.0" encoding="utf-8" standalone="yes" ?> > <uyeler> > <uye> > <ad>mustafa</ad> > <soyad>tekin</soyad> > <email>mustafa@hedehodo</email> > </uye> > <uye> > <ad>ahmet</ad> > <soyad>mehmet</soyad> > <email>mus@hedehodo</email> > </uye> > </uyeler> > EOF; > > > > $xml = new SimpleXMLElement($xml, TRUE); > > foreach($xml as $uye) > { > echo 'Ad : '.$uye->ad."\n"; > echo 'Soyad : '.$uye->soyad."\n"; > echo 'Email : '.$uye->email."\n"; > } > ?> > > 2011/8/15 onuRRR <[email protected]> > >> hocam gene olmadı, >> >> C:\vkmeyva\deneme>c:\php\php.exe -c c:\WINNT\php.ini >> c:\vkmeyva\deneme\dene2.php >> PHP Warning: simplexml_load_file(): doviz.xml:9: parser error : Extra >> content at the end of the document in >> C:\vkmeyva\deneme\dene2.php on line 4 >> >> Warning: simplexml_load_file(): doviz.xml:9: parser error : Extra content >> at the end of the document in C:\vk >> meyva\deneme\dene2.php on line 4 >> PHP Warning: simplexml_load_file(): </xml> in C:\vkmeyva\deneme\dene2.php >> on line 4 >> >> Warning: simplexml_load_file(): </xml> in C:\vkmeyva\deneme\dene2.php on >> line 4 >> PHP Warning: simplexml_load_file(): ^ in C:\vkmeyva\deneme\dene2.php on >> line 4 >> >> Warning: simplexml_load_file(): ^ in C:\vkmeyva\deneme\dene2.php on line 4 >> PHP Fatal error: Uncaught exception 'Exception' with message 'String >> could not be parsed as XML' in C:\vkmey >> va\deneme\dene2.php:5 >> Stack trace: >> #0 C:\vkmeyva\deneme\dene2.php(5): SimpleXMLElement->__construct('', 1) >> #1 {main} >> thrown in C:\vkmeyva\deneme\dene2.php on line 5 >> >> Fatal error: Uncaught exception 'Exception' with message 'String could not >> be parsed as XML' in C:\vkmeyva\de >> neme\dene2.php:5 >> Stack trace: >> #0 C:\vkmeyva\deneme\dene2.php(5): SimpleXMLElement->__construct('', 1) >> #1 {main} >> thrown in C:\vkmeyva\deneme\dene2.php on line 5 >> >> >> 2011/8/15 Mustafa Kahraman <[email protected]> >> >>> Oncekinde tirnaklarda hata var !!! >>> Dogrusu bu >>> >>> <?php >>> >>> $xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?> >>> >>> <uyeler> >>> <uye> >>> <ad>mustafa</ad> >>> <soyad>tekin</soyad> >>> <email>mustafa@hedehodo</email> >>> </uye> >>> </uyeler></xml>'; >>> >>> >>> $xml = new SimpleXMLElement($xml, TRUE); >>> >>> >>> echo "<pre>"; >>> print_r($xml); >>> echo "</pre>"; >>> >>> >>> echo 'Ad : '.$xml->uye->ad.'<br />'; >>> echo 'Soyad : '.$xml->uye->soyad.'<br />'; >>> echo 'Email : '.$xml->uye->email.'<br />'; >>> >>> _______________________________________________ >>> Linux-programlama mailing list >>> [email protected] >>> https://liste.linux.org.tr/mailman/listinfo/linux-programlama >>> Liste kurallari: http://liste.linux.org.tr/kurallar.php >>> >>> >> >> >> -- >> antiCobol.. >> >> _______________________________________________ >> Linux-programlama mailing list >> [email protected] >> https://liste.linux.org.tr/mailman/listinfo/linux-programlama >> Liste kurallari: http://liste.linux.org.tr/kurallar.php >> >> > > _______________________________________________ > Linux-programlama mailing list > [email protected] > https://liste.linux.org.tr/mailman/listinfo/linux-programlama > Liste kurallari: http://liste.linux.org.tr/kurallar.php > > -- antiCobol..
_______________________________________________ Linux-programlama mailing list [email protected] https://liste.linux.org.tr/mailman/listinfo/linux-programlama Liste kurallari: http://liste.linux.org.tr/kurallar.php
