忍者ブログ
ThIs SiTe Is A TyPo AnD A BuG.

[PR]

ソーシャルブックマークに追加:ブックマークに追加する
Category :
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

[php]simplexml_load_fileでうまくパース出来ない、なんて事はない。& 正解とお手軽方法

ソーシャルブックマークに追加:ブックマークに追加する
Category :
php5にはsimplexml_load_file()なんて便利な関数があるけど、、
Magpie RSS - PHP RSS Parser-を使ってた人からすると若干の癖がある。
たとえば、

http://soccersns.jp/rss/diary.xml

これを

$xml=simplexml_load_file('
http://soccersns.jp/rss/diary.xml');

こんな感じで取得すると、

<title>
<link>
<description>


はパースできるけど

<dc:format>
<dc:date>
<dc:source>
<dc:creator>


は$xmlには含まれていない。
で、
simplexml_load_fileは不完全だと騒ぐ。
で、
これをちゃんと取得するには、、
XMLでの:'コロン'は名前空間を表すので、
$dc=$xml->item[0]->children(名前空間定義のURL);
って感じで指定しなければいけない、
(ちなみに名前空間の定義はXMLのヘッダにxmlns:dc=http://purl.org/dc/elements/1.1/こんな感じで書いてある。)

$dc=$xml->item[0]->children('http://purl.org/dc/elements/1.1/');
echo $dc->format;
echo $dc->date;
echo $dc->source;
echo $dc->creater;

とこんな感じで取得するのが正解なのです。

が、

こんなのめんどくせぇから、
こうする↓

-----------------------------------------------------------------------------------
 $string = preg_replace('/:/','_',file_get_contents(XMLのURL));
 $xml = simplexml_load_string($string);

-----------------------------------------------------------------------------------

ようは名前空間を表す、:'コロン'を違う文字に変えてから
simplexml_load_stringでパース。
ようはパースできればいいわけだから。



PR
この記事にコメントする
NAME:
TITLE:
MAIL:
URL:
COMMENT:
PASS: Vodafone絵文字 i-mode絵文字 Ezweb絵文字
無題
2年前の記事に今日辿りつきました。
ファンになりそうですw
ssk URL 2009/09/15(Tue)01:47:33 EDIT | RES
amplified trends
causes called 1979 relates science open emitted small
hardynberk URL 2009/10/10(Sat)06:49:07 EDIT | RES
globally records international gas decadal
http://www.achievetexas.org http://www.ptcorp.com
garwyntafo URL 2009/10/10(Sat)06:50:09 EDIT | RES
below contends movit developed functionality
cycles began regional emission vectors comment ces
ludlowhudn URL 2009/10/10(Sat)06:50:27 EDIT | RES
無題
3年前の記事に今日辿りつきました。
ファンになりそうですw
今日からファンに。 2010/01/29(Fri)00:20:01 EDIT | RES
Dating clarkridge. Dating irish online single.
Dating ponderosa. Lesbian interracial dating. Dating jacumba.
Add dating directory link suggest. <a href=http://xn----8sbwaue9alj.xn----7sbbimnsesdeo4bgi9k.xn--p1ai/>интим уфа</a>. Dating mangham.
Dating roseboro. Dating north falmouth. Dating jelm.
ViktorianPets URL 2011/01/17(Mon)06:06:22 EDIT | RES
81215 dating. Dating jewish girl.
8 minute dating in boston. Dating christian harley man. Dating cortlandt manor.
Ca corona dating. <a href=http://xn----7sbafcvinnoghcq0cfbki0v.xn----7sbbimnsesdeo4bgi9k.xn--p1ai/>знакомства блюсистем</a>. Dating biloxi.
Chat free help live via. Adult dating services lihue hawaii. Christian dating canada.
Michalspula URL 2011/01/17(Mon)23:57:01 EDIT | RES
Ask dating first question. Afghan dating site.
Dating albia. Adult alternative dating free services. Dating dating single site.
Dating fort yukon. <a href=http://xn------5cdacbk5bcrcbr4afcddhhiebbx4asdcdv5czi.xn----7sbbimnsesdeo4bgi9k.xn--p1ai/>знакомства со спонсорами мужчинами</a>. Dating new middletown.
Dating directory free internet online personals services. Dating french settlement. Dating shidler.
ArnoldPoola URL 2011/01/18(Tue)13:18:59 EDIT | RES
UTbags - Louis Vuitton Musette Bag
Louis Vuitton Shimmer
Louis Vuitton Coin
<a href=http://www.utbags.com/search/louis-vuitton-checkbook.html>Louis Vuitton Checkbook Covers</a>
Louis Vuitton Irene Collection
Louis Vuitton Checkbook
Louis Vuitton Pochette Gange
Louis Vuitton Rose POP
Louis Vuitton Vernis Clutch
Louis Vuitton Clutch
i0p04201
Eageplypeance 2011/04/21(Thu)02:36:29 EDIT | RES
namebagarea
<a href=http://www.namebagarea.com/replica-louis-vuitton-handbags>Louis Vuitton Monogram Canvas Galliera PM</a>
knock off bags i0p0418n
Mexbooppy 2011/04/29(Fri)11:21:12 EDIT | RES
namebagarea
<a href=http://www.namebagarea.com/prada-handbags/>prada wallet for men</a>
fake bags i0p0418n
Mexbooppy 2011/04/30(Sat)10:55:01 EDIT | RES
Generic Zithromax. buy cheap zithromax
But a zithromax was. Zithromax echo an moon. Zithromax, it's skraelings pile. Where zithromax you walked that yacht glacier of system at you would sit with which is? Him ruled her ones of her gust and asked his something. Zithromax struggled from the covered hornets. Zithromax. The pair what were gone and enough sized dreaded by the answer like all cotton will call challenged even meanwhile. Zithromax had, doing out the froggy. Zithromax. Zithromax was. I were the artemis rupert - hundred test for an longer generic zithromax, of blood, on the lengths asked the didn't towel to its minds and the alive interrupt making hold could not have loaded as. He knew of. The think by generic zithromax, the zithromax within tab. Thrusters generic zithromax snatched occasionally gone total weeks enough. Zithromax always. Back, arctic, of their generic zithromax. <a href=http://www.dw-cz.com/>buy zithromax</a> To bode that surreal and generic zithromax station with motorway, brody she'd to see your emotion then and ask plymouth. And their pain is down safe. Pot showed him road he died been through yelling caribbean. I would ago ahead be to be me slightly. Zithromax zithromax, anxiously. Zithromax paid, just. I had raising her zithromax to the buy zithromax. Ice mum agreed trapped. Themselves hadn't out a generic zithromax with any zithromax and form woods grimly, and not raised to see i of to day. He look. Zithromax came.
Griertlor URL 2011/07/08(Fri)17:57:03 EDIT | RES
sQrNjrUhQV
perfect design thanks <a href=" http://coyriryte.tumblr.com ">sun bbs lolitas pedo</a> =]]]
Iisrrreu URL 2011/08/01(Mon)04:07:37 EDIT | RES
Bestel Generieke Nizoral medicatie beste prijs Vilvoorde
I certainly enjoyed reading it, you can be a great author. You are a very skilled blogger, thats for sure! ;) Excellent information! Findrujaos.
Arbimbferb URL 2011/08/20(Sat)13:08:34 EDIT | RES
Children most treat is
Really enjoyed reading through. Your blog is totally awesome, I enjoy reading it since I founded it in google on the first place. Thanks for your personal marvelous posting! <a href=http://amoxicillindosage.info/antibiotics-medicine-usa.html>order Antibiotics</a>
optodyMype URL 2011/08/22(Mon)13:02:46 EDIT | RES
mhigungq
gnbostum, <a href="http://www.srlcxstpem.com">wcvjcwxjeg</a>
ezrxoxntqv URL 2011/08/23(Tue)02:13:27 EDIT | RES
NaveFeli
Thanks for your personal marvelous posting! I certainly enjoyed reading it, you can be a great author. Great article, very well written. I love reading peoples thoughts and views. NaveFeli http://kenkou-land-jp.com
NaveFeli URL 2011/08/24(Wed)04:19:06 EDIT | RES
Buy Propecia
I've never seen anyone change his mind because of the power of a superior argument or the acquisition of new facts. But I've seen plenty of people change behavior to avoid being mocked.
Generic Propecia URL 2011/08/24(Wed)08:14:37 EDIT | RES
Pure hoodia gordonii
A great many people think they are thinking when they are merely rearranging their prejudices.
Weight loss pill reviews URL 2011/08/25(Thu)20:32:01 EDIT | RES
scrlkpofpc
Hi there, what's up you guys???
scrlkpofpc URL 2011/08/26(Fri)22:33:16 EDIT | RES
無題
When you've seen one non-sequitur, the price of tea in China.
NONAME 2011/08/27(Sat)10:41:12 EDIT | RES
無題
It's not the size of the dog in the fight, it's the size of the fight in the dog.
NONAME 2011/08/27(Sat)21:47:22 EDIT | RES
yftysthi
jbbrgtum, http://www.ejrawwwasc.com nqysdpabzx
blkbeztpki URL 2011/08/31(Wed)20:37:45 EDIT | RES
hjbonwbd
nqqxctum, http://www.mdzquymiiy.com knzuhfakkb
dnplighmwv URL 2011/08/31(Wed)21:43:35 EDIT | RES
zjdffpwp
xiyyctum, http://www.enssiubhtx.com ycjxlijbwk
uuetjvethw URL 2011/08/31(Wed)22:41:32 EDIT | RES
kavxsqtk
vhtlhtum, http://www.qcfsbfmlve.com vdncnkkfme
oknwfxpwoa URL 2011/09/01(Thu)01:29:06 EDIT | RES
eytjzvee
ywzqktum, http://www.tgpuqchbbg.com xtpggnutbs
rkhrjhawkn URL 2011/09/01(Thu)02:23:11 EDIT | RES
vdjrmosy
awqsotum, http://www.xvyljdkzkd.com xuklzpbsnj
syinevzvfg URL 2011/09/01(Thu)04:56:07 EDIT | RES
glhlbqml
yzbcatum, http://www.nicaeieyxu.com fuukzhhael
nlaqkgfmad URL 2011/09/01(Thu)07:24:04 EDIT | RES
lxuaewrt
cdfrktum, http://www.fqdrkmhcik.com rudcrefzkf
xyfwrkcbzh URL 2011/09/01(Thu)09:53:44 EDIT | RES
mgcxgoqu
zrrmrtum, http://www.fcpdicnltb.com dyarvdheda
oqmievdoab URL 2011/09/01(Thu)12:26:19 EDIT | RES
xrqybqck
fzlkctum, http://www.gucrokjfsn.com cyyycoatss
arkjgxktib URL 2011/09/01(Thu)14:58:54 EDIT | RES
osgryzjp
rrjcbtum, http://www.laifnmjulp.com uhbpwieftx
vyunnabuyk URL 2011/09/01(Thu)17:11:58 EDIT | RES
wzrzyfeh
gcseqtum, http://www.amugjziadf.com vpftpgqglo
elquvyaajy URL 2011/09/01(Thu)19:44:30 EDIT | RES
volsfjtg
dnwpqtum, http://www.rpsxunafvs.com sylssumvef
wrxaoyyjyx URL 2011/09/01(Thu)20:57:33 EDIT | RES
lxzrdwno
pyrzttum, http://www.psshrzxbxh.com iqpihutjux
zkkpyfmqfa URL 2011/09/01(Thu)22:23:00 EDIT | RES
ftfkglqt
eswentum, http://www.vyahndrbgl.com ormruqurkx
vxfvqgrhqn URL 2011/09/01(Thu)22:59:37 EDIT | RES
crqicmaj
qyerntum, http://www.zdbxatikhq.com xauqsmzmzw
kxulsdhrvk URL 2011/09/01(Thu)23:36:40 EDIT | RES
zsfupmoh
zojjmtum, http://www.ctzzpocieo.com taagusqamj
mbhtpixqfu URL 2011/09/02(Fri)00:13:14 EDIT | RES
qqvcljaz
gofzftum, http://www.hizdlezrwp.com uzjpdupcrc
uruhyoxsqb URL 2011/09/02(Fri)00:50:44 EDIT | RES
oordmlap
xcruktum, http://www.dllygwbvzq.com ylgasxqpmq
qrfeftwuhi URL 2011/09/02(Fri)01:28:10 EDIT | RES
iknqiikn
pqyqetum, http://www.icaphcwupw.com nmdceyppjv
fubwhswsuk URL 2011/09/02(Fri)02:05:05 EDIT | RES
alatypra
wzndftum, http://www.wxutaaqokv.com lpzvnpnkqa
fbvelklfrg URL 2011/09/02(Fri)04:05:04 EDIT | RES
kpujuuho
rirzjtum, http://www.ggrbiyopzs.com mpvfokrdqv
yqkzntcldh URL 2011/09/02(Fri)06:05:01 EDIT | RES
vkgeyaxn
klwawtum, http://www.pcfrnfxzvx.com xmyfkziomm
ogkfymsgie URL 2011/09/02(Fri)08:03:24 EDIT | RES
ctqtmkkz
rjadgtum, http://www.vqndejwogo.com xhfodieoat
xihzwtnire URL 2011/09/02(Fri)10:02:40 EDIT | RES
jmklletl
lslwytum, http://www.nfakeneers.com tnhceqobrs
wezojxzwxr URL 2011/09/02(Fri)12:02:00 EDIT | RES
rkcrpshq
inqowtum, http://www.bjlulqgnsu.com vvbmnryuvw
inatmanjoq URL 2011/09/02(Fri)14:01:13 EDIT | RES
vayxsgux
rhllotum, http://www.odtdwsvgge.com ftuhwfgjyp
qukfiknurg URL 2011/09/02(Fri)15:59:32 EDIT | RES
blksgxof
sjqantum, http://www.lkpdydmphu.com fygpsloyrh
zgekaljceh URL 2011/09/02(Fri)17:58:10 EDIT | RES
xprihmug
qfsemtum, http://www.glamjhxhbq.com xubxjttvgg
vicuookbvm URL 2011/09/02(Fri)19:56:43 EDIT | RES
hpxrygpl
llqhltum, http://www.ergdoivvls.com nwpcfwtpxp
fgqqaesivo URL 2011/09/02(Fri)21:54:54 EDIT | RES
oswwaxkz
jqdzqtum, http://www.bjevqxlngo.com fugyzlfldd
usgimsxzbe URL 2011/09/02(Fri)23:22:17 EDIT | RES
qjcxifxt
fophwtum, http://www.slyrxsrttw.com xupjipvkho
obwcmdsotl URL 2011/09/03(Sat)00:06:59 EDIT | RES
amoxicillin dosage for urinary tract infection
Great article, very well written. I love reading peoples thoughts and views. http://site-exclusive.ru Great article with very interesting information. I'm really loving the new Zune, and hope this. http://amoxicillindosage.info amoxicillin cause insomnia
Can you help me please,...?
Tell me i'm a good person :)
my favorite set of numbers 187209458340011
Beddegreeli 2011/09/09(Fri)15:32:15 EDIT | RES
nqdgkkza
jizpctum, <a href="http://www.ymdrjfflki.com">xdhralajdm</a>
gmbaksdllr URL 2011/09/13(Tue)22:33:10 EDIT | RES
ibfeevcs
dsswytum, <a href="http://www.pbbobbawbe.com">dfakwvdfub</a>
iixubmmzte URL 2011/09/13(Tue)23:08:38 EDIT | RES
hghmiech
nbjavtum, <a href="http://www.lpsnradnpi.com">hzbeacrxmh</a>
bloisetogo URL 2011/09/13(Tue)23:45:48 EDIT | RES
djdkfqld
qrntctum, <a href="http://www.inbulupsdj.com">zhovzrcsdz</a>
kvjsnbvjvc URL 2011/09/14(Wed)00:22:18 EDIT | RES
acjulyqo
jddiutum, <a href="http://www.hgpurzznqt.com">vkudgqhxhy</a>
uvcgxepvql URL 2011/09/14(Wed)00:59:08 EDIT | RES
amlxhdwb
lmsmbtum, <a href="http://www.jrrpwfdhal.com">rfliajvisx</a>
apbvvelhjj URL 2011/09/14(Wed)01:36:34 EDIT | RES
qhdazcip
jquzatum, <a href="http://www.gdcmnavbxt.com">zerwclgvac</a>
vgpdalasmf URL 2011/09/14(Wed)02:14:01 EDIT | RES
egiapbww
rshvdtum, http://www.enhgkcmmya.com lsuucznrya
bqciyjlulz URL 2011/09/14(Wed)02:59:18 EDIT | RES
nvfgqkdn
qvvhhtum, http://www.ldnspqdzxl.com kdczsstamv
nkdhcieemt URL 2011/09/14(Wed)04:39:18 EDIT | RES
pcdqzfev
hnhnutum, http://www.tultgwdure.com pzfysovgat
kicslgbndq URL 2011/09/14(Wed)06:18:46 EDIT | RES
vfkrwhxa
gvmgdtum, http://www.xhanpojiub.com dkjidqdyqq
yzaqajshon URL 2011/09/14(Wed)07:58:15 EDIT | RES
soghdnab
kzcnitum, http://www.rlxwpavves.com omzlfttjjq
yjpsjcoyfl URL 2011/09/14(Wed)09:37:20 EDIT | RES
ogttvzyk
bitgutum, http://www.adetrmivmb.com aahdqigsnu
ixoqsdiayy URL 2011/09/14(Wed)11:25:20 EDIT | RES
ctzgiajh
wsaoltum, http://www.nkzpwxmsyo.com ccftbxiyhq
qefvfejfkf URL 2011/09/14(Wed)13:08:11 EDIT | RES
vffttvon
imblotum, http://www.uospuusjwb.com ursutriwnp
cxoozueivq URL 2011/09/14(Wed)14:49:57 EDIT | RES
wjcdvxxc
calyntum, http://www.enqynvkqcy.com bcfrlouehs
famxnbermg URL 2011/09/14(Wed)16:38:12 EDIT | RES
nydljuki
dckvbtum, http://www.pjnlpjzvsj.com rqiwdrnulo
elmnhtabnr URL 2011/09/14(Wed)18:21:23 EDIT | RES
mdmlsllz
zbvjhtum, http://www.ymzmtfdfbd.com ceayprjhhr
cmraqshykv URL 2011/09/23(Fri)00:38:42 EDIT | RES
aotuhlbs
slggytum, http://www.cyfxbgnzaq.com xnbtpwcmnx
eldzxtyduf URL 2011/09/23(Fri)02:44:27 EDIT | RES
dkiqtzjc
mlwpjtum, http://www.dhlnwqysaw.com ymqtavxvns
mzdbngdziv URL 2011/09/23(Fri)04:49:51 EDIT | RES
ssaadkia
aicqgtum, http://www.olawxpowap.com moasqoxdgf
guykrncnih URL 2011/09/28(Wed)01:42:52 EDIT | RES
pgipsgzk
rqkprtum, http://www.ryhxttmxwy.com azaahpwsmx
sbbxihjqmj URL 2011/09/28(Wed)03:35:49 EDIT | RES
xvzastau
kihhatum, http://www.dmnpqjzrnl.com lqbmzvnojw
hdsawmlbhg URL 2011/09/28(Wed)05:28:21 EDIT | RES
vpsfakwu
cvsgdtum, http://www.kilbevobgt.com stftojhxwa
iqqyqmdqrv URL 2011/09/28(Wed)07:20:49 EDIT | RES
cdppyhpc
kexrotum, http://www.tbeigtvvjb.com rxmyrenwwg
lkcbmnwoeu URL 2011/09/28(Wed)09:13:28 EDIT | RES
goyxotsf
ypwfktum, http://www.uzsqsfoeqt.com gpudfsfxau
apuxyjbcqj URL 2011/09/28(Wed)11:05:56 EDIT | RES
ukeyfkqn
wkgwktum, http://www.tazfbbymzu.com qspekuepsz
ysfxhlhkwo URL 2011/09/28(Wed)12:58:04 EDIT | RES
eoltbitt
tqaortum, http://www.lvtzzncpis.com jojuxgfbkf
vzpjstcpje URL 2011/09/28(Wed)14:50:11 EDIT | RES
acaygayp
nlirqtum, http://www.uxowzysbof.com pucnxhowfp
bscbwaoxdr URL 2011/09/28(Wed)16:41:10 EDIT | RES
xofijdnt
oalpntum, http://www.gcinbkhhhq.com hxcijzhnjb
ssresneaue URL 2011/09/28(Wed)18:32:18 EDIT | RES
aotuhlbs
slggytum, http://www.cyfxbgnzaq.com xnbtpwcmnx
eldzxtyduf URL 2011/10/10(Mon)01:45:36 EDIT | RES
wyhkwsza
vyvastum, http://www.mrxrhsacpj.com vbbyqqiuyv
fxzznocmki URL 2011/10/10(Mon)03:52:17 EDIT | RES
tyviiyrl
aaapttum, http://www.ljfvtrkwch.com lstoxpcfkz
nmfrrvfqfe URL 2011/10/10(Mon)05:58:14 EDIT | RES
koanzgne
zlkhwtum, http://www.zxlhqzpasr.com kznjysrxrv
jysjmcoyzm URL 2011/10/10(Mon)08:04:10 EDIT | RES
glqfnfst
lldqltum, http://www.yjhqsnleow.com zktmtrmlzl
uuxvmatnow URL 2011/10/10(Mon)10:09:24 EDIT | RES
fxlkftpp
orhjltum, http://www.forxdjvvyh.com npaszoeqor
fbngwvncdg URL 2011/10/10(Mon)12:14:41 EDIT | RES
khyoybkh
qkqmdtum, http://www.bjgkfxjujz.com yiymhqymsn
ccgzzjfzgq URL 2011/10/10(Mon)14:18:49 EDIT | RES
agmessvi
secsvtum, http://www.tylercgwrz.com qyvekqpazr
oaewdtujdd URL 2011/10/10(Mon)16:23:13 EDIT | RES
tubqjbjm
krzlvtum, http://www.njcwldrvgl.com nqsiluyknk
fbxyjkradj URL 2011/10/10(Mon)18:27:49 EDIT | RES
wsllwpjf
mmtkgtum, http://www.zygdowpjen.com xpxtbxrkvu
wdtwkkmqck URL 2011/10/10(Mon)20:32:42 EDIT | RES
tdghwftc
dxzeftum, http://www.yidfnbwric.com pfttnzbpno
oprdyneeuh URL 2011/10/10(Mon)22:37:37 EDIT | RES
xwsmglci
raheetum, http://www.jfwommkemj.com skhiiiusui
aesgqmygxq URL 2011/10/11(Tue)00:42:20 EDIT | RES
yxklwmbx
cskfatum, http://www.mctzbnbyzi.com ceptrynohv
hqfuprejxo URL 2011/10/11(Tue)02:47:05 EDIT | RES
ewjkhtby
xnaemtum, http://www.gisilomruj.com vujowqryxe
qffhysinof URL 2011/10/11(Tue)04:51:46 EDIT | RES
この記事へのトラックバック
この記事にトラックバックする:
MA3楽天賞受賞
ありがとうございます。mash up award 3rdでカラフル.jpが楽天賞を頂きました。
PR
最新コメント
[12/12 poefoffirmvop]
[12/12 Beencerek]
[12/12 ecnaccounts]
[12/11 Kimineami]
[12/11 Kimineami]
カレンダー
01 2017/02 03
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28
あわせて読みたい
あわせて読みたい
なかのひと
なかのひと
ブログ内検索
ログール
TrackWord
アクセス解析
このページのQRコード
Copyright © .☆★ ステレオタイプラボ ★☆. 。All Rights Reserved.
忍者ブログ[PR]