kuwao Posted June 7, 2008 Share Posted June 7, 2008 hello, I need to parse following XMl into array. Could you help me pls? I need mainy (or only) <cc> and <dayf> and it's inner values ... Thanks for your help <?xml version="1.0" encoding="ISO-8859-1"?> <weather ver="2.0"> <head> <locale>en_US</locale> <form>MEDIUM</form> <ut>F</ut> <ud>mi</ud> <us>mph</us> <up>in</up> <ur>in</ur> </head> <loc id="30339"> <dnam>Atlanta, GA (30339)</dnam> <tm>9:47 AM</tm> <lat>33.87</lat> <lon>-84.47</lon> <sunr>6:26 AM</sunr> <suns>8:47 PM</suns> <zone>-4</zone> </loc> <lnks type="prmo"> <link pos="1"> <l>http://www.weather.com/allergies?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link1&cm_ite=Allergies</l> <t>Local Pollen Reports</t> </link> <link pos="2"> <l>http://www.weather.com/flights?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link2&cm_ite=BusinessTraveler</l> <t>Airport Conditions</t> </link> <link pos="3"> <l>http://www.weather.com/garden?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link3&cm_ite=Garden</l> <t>Lawn and Garden Weather</t> </link> <link pos="4"> <l>http://www.weather.com/traffic?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link4&cm_ite=Traffic</l> <t>Rush Hour Traffic</t> </link> </lnks> <cc> <lsup>6/7/08 9:25 AM EDT</lsup> <obst>The Weather Channel, GA</obst> <tmp>82</tmp> <flik>87</flik> <t>Sunny</t> <icon>32</icon> <bar> <r>30.24</r> <d>steady</d> </bar> <wind> <s>calm</s> <gust>N/A</gust> <d>0</d> <t>CALM</t> </wind> <hmid>68</hmid> <vis>8.0</vis> <uv> <i>2</i> <t>Low</t> </uv> <dewp>71</dewp> <moon> <icon>4</icon> <t>Waxing Crescent</t> </moon> </cc> <dayf> <lsup>6/7/08 9:07 AM EDT</lsup> <day d="0" t="Saturday" dt="Jun 7"> <hi>93</hi> <low>72</low> <sunr>6:26 AM</sunr> <suns>8:47 PM</suns> <part p="d"> <icon>34</icon> <t>Mostly Sunny</t> <wind> <s>4</s> <gust>N/A</gust> <d>251</d> <t>WSW</t> </wind> <bt>M Sunny</bt> <ppcp>20</ppcp> <hmid>53</hmid> </part> <part p="n"> <icon>29</icon> <t>Partly Cloudy</t> <wind> <s>3</s> <gust>N/A</gust> <d>267</d> <t>W</t> </wind> <bt>P Cloudy</bt> <ppcp>20</ppcp> <hmid>68</hmid> </part> </day> <day d="1" t="Sunday" dt="Jun 8"> <hi>96</hi> <low>72</low> <sunr>6:26 AM</sunr> <suns>8:48 PM</suns> <part p="d"> <icon>34</icon> <t>Mostly Sunny</t> <wind> <s>5</s> <gust>N/A</gust> <d>72</d> <t>ENE</t> </wind> <bt>M Sunny</bt> <ppcp>20</ppcp> <hmid>51</hmid> </part> <part p="n"> <icon>33</icon> <t>Mostly Clear</t> <wind> <s>4</s> <gust>N/A</gust> <d>164</d> <t>SSE</t> </wind> <bt>M Clear</bt> <ppcp>20</ppcp> <hmid>65</hmid> </part> </day> <day d="2" t="Monday" dt="Jun 9"> <hi>93</hi> <low>71</low> <sunr>6:26 AM</sunr> <suns>8:48 PM</suns> <part p="d"> <icon>37</icon> <t>Isolated T-Storms</t> <wind> <s>8</s> <gust>N/A</gust> <d>168</d> <t>SSE</t> </wind> <bt>Iso T-Storms</bt> <ppcp>30</ppcp> <hmid>56</hmid> </part> <part p="n"> <icon>29</icon> <t>Partly Cloudy</t> <wind> <s>2</s> <gust>N/A</gust> <d>220</d> <t>SW</t> </wind> <bt>P Cloudy</bt> <ppcp>20</ppcp> <hmid>69</hmid> </part> </day> <day d="3" t="Tuesday" dt="Jun 10"> <hi>88</hi> <low>71</low> <sunr>6:26 AM</sunr> <suns>8:49 PM</suns> <part p="d"> <icon>37</icon> <t>Isolated T-Storms</t> <wind> <s>4</s> <gust>N/A</gust> <d>247</d> <t>WSW</t> </wind> <bt>Iso T-Storms</bt> <ppcp>30</ppcp> <hmid>61</hmid> </part> <part p="n"> <icon>11</icon> <t>Showers</t> <wind> <s>0</s> <gust>N/A</gust> <d>276</d> <t>CALM</t> </wind> <bt>Showers</bt> <ppcp>30</ppcp> <hmid>70</hmid> </part> </day> <day d="4" t="Wednesday" dt="Jun 11"> <hi>90</hi> <low>70</low> <sunr>6:26 AM</sunr> <suns>8:49 PM</suns> <part p="d"> <icon>37</icon> <t>Isolated T-Storms</t> <wind> <s>3</s> <gust>N/A</gust> <d>273</d> <t>W</t> </wind> <bt>Iso T-Storms</bt> <ppcp>30</ppcp> <hmid>60</hmid> </part> <part p="n"> <icon>29</icon> <t>Partly Cloudy</t> <wind> <s>0</s> <gust>N/A</gust> <d>68</d> <t>CALM</t> </wind> <bt>P Cloudy</bt> <ppcp>20</ppcp> <hmid>74</hmid> </part> </day> </dayf> </weather> Link to comment https://forums.phpfreaks.com/topic/109143-xml-parsing-to-array/ Share on other sites More sharing options...
kuwao Posted June 9, 2008 Author Share Posted June 9, 2008 NOBODY ??? Link to comment https://forums.phpfreaks.com/topic/109143-xml-parsing-to-array/#findComment-561078 Share on other sites More sharing options...
Darklink Posted June 9, 2008 Share Posted June 9, 2008 Theres different ways of doing this. It's not as easy as it may look. You may want to check out some XML tutorials online or use an XML Parser. I believe there are a few. Link to comment https://forums.phpfreaks.com/topic/109143-xml-parsing-to-array/#findComment-561107 Share on other sites More sharing options...
aseaofflames Posted June 9, 2008 Share Posted June 9, 2008 try using xmlParser by Eric Pullman http://eric.pollmann.net/items/2007/2/2007_02_12_xmlparser/ Link to comment https://forums.phpfreaks.com/topic/109143-xml-parsing-to-array/#findComment-561110 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.