Jump to content


Photo

simple xml and :


  • Please log in to reply
1 reply to this topic

#1 dragongamer

dragongamer
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 24 August 2006 - 06:37 PM

hi, i have a xml file that i need to be prahsed, via php's 5 simplexml_load_file, the only problem is that i need to get the atraibues,
E.G
->foo['OMG']

but the line that has the data is
<yweather:condition text="Fair" code="34" temp="64" date="Thu, 24 Aug 2006 6:50 pm BST" />

and if i try
$xml->channel->item->yweather:condition['code'];

i simply get

Parse error: syntax error, unexpected ':', expecting ',' or ';'


is there a work around or very simple fix for this?

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 24 August 2006 - 07:50 PM

A colon is used for namespaces. Try one of the namespace methods.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users