Bu XML'i Php İle Nasıl Parse Ederim
-
Arkadaşlar merhabalar,
bir xml entegrasyonu yapıyorum da biraz yardıma ihtiyacım var,
elimdeki xml bu.<!--?xml version="1.0" encoding="utf-8"?--> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:body> <getikonnewsfeedresponse xmlns="http://ikonnewsfeed.org/"> <getikonnewsfeedresult> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:isdataset="true" msdata:maindatatable="NewsFeedResult" msdata:usecurrentlocale="true"> <xs:complextype> <xs:choice minoccurs="0" maxoccurs="unbounded"> <xs:element name="NewsFeedResult"> <xs:complextype> <xs:sequence> <xs:element name="NewsID" type="xs:int" minoccurs="0"> <xs:element name="NewsTitle" type="xs:string" minoccurs="0"> <xs:element name="NewsText" type="xs:string" minoccurs="0"> <xs:element name="NewsDate" type="xs:string" minoccurs="0"> </xs:element> </xs:element> </xs:element> </xs:element> </xs:sequence> </xs:complextype> </xs:element> </xs:choice> </xs:complextype> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <newdataset xmlns=""> <newsfeedresult diffgr:id="NewsFeedResult1" msdata:roworder="0"> <newsid>10</newsid> <newstitle>Başlık</newstitle> <newstext>İçerik</newstext> <newsdate>2017-03-14 01:01:53</newsdate> </newsfeedresult> <newsfeedresult diffgr:id="NewsFeedResult2" msdata:roworder="1"> <newsid>11</newsid> <newstitle>Başlık</newstitle> <newstext>İçerik</newstext> <newsdate>2017-03-14 01:05:53</newsdate> </newsfeedresult> </newdataset> </diffgr:diffgram> </getikonnewsfeedresult> </getikonnewsfeedresponse> </soap:body> </soap:envelope>
Şimdiden herkese teşekkürler :)
-
Dostum bu soap, bir soap objesi olusturup ona al, zaten xml i sana obje olarak verecek. Sonra o objeyi istediğin gibi hoplatirsin.
Ha illa xml olarak ugrasacam diyosan, bu xmldeki namespace leri str_replace ile temizle, sonra simplexml e al.
Simplexml yada soap kullanmayı bilmiyorsan Google da zibilyon tane örnek var