What's the difference between Web 3.0 and Web 2.0?

What is the best way to edit an XML file within a web page?

  • I have an XML file that is used by FusionCharts Free to draw a line graph. I want to add Drill-down functionality but allowing the user to pick a range of the file and produce a new graph. What is the best way to do this? <graph caption="Share Data Wave" subcaption="For Person's Name" xAxisName="Time" yAxisMinValue="-0.025" yAxisName="Voltage" decimalPrecision="5" formatNumberScale="0" numberPrefix="" showNames="1" showValues="0" showAlternateHGridColor="1" AlternateHGridColor="ff5904" divLineColor="ff5904" divLineAlpha="20" alternateHGridAlpha="5"> <set name="2010-08-27 12:00:20.636" value="25.020000" hoverText = "The difference from last value: 0" ></set> <set name="2010-08-27 12:01:19.473" value="15.000000" hoverText = "The difference from last value: -10.02" ></set> <set name="2010-08-27 12:01:24.494" value="15.020000" hoverText = "The difference from last value: 0.0199999999999996" ></set> <set name="2010-08-27 12:01:44.188" value="18.250000" hoverText = "The difference from last value: 3.23" ></set> <set name="2010-08-27 12:02:11.851" value="18.540000" hoverText = "The difference from last value: 0.289999999999999" ></set> <set name="2010-08-27 12:02:47.109" value="16.520000" hoverText = "The difference from last value: -2.02" ></set> <set name="2010-08-27 12:03:01.199" value="17.500000" hoverText = "The difference from last value: 0.98" ></set> <set name="2010-08-27 12:03:03.030" value="25.020000" hoverText = "The difference from last value: 7.52" ></set> <set name="2010-08-27 12:03:40.570" value="30.000000" hoverText = "The difference from last value: 4.98" ></set> <set name="2010-08-27 12:04:27.490" value="32.250000" hoverText = "The difference from last value: 2.25" ></set> <set name="2010-08-27 12:05:03.738" value="26.050000" hoverText = "The difference from last value: -6.2" ></set> <set name="2010-08-27 12:05:14.511" value="18.540000" hoverText = "The difference from last value: -7.51" ></set> <set name="2010-08-27 12:06:09.728" value="16.520000" hoverText = "The difference from last value: -2.02" ></set> <set name="2010-08-27 12:06:58.329" value="17.500000" hoverText = "The difference from last value: 0.98" ></set> </graph> For example if I only want 2010-08-27 12:05:03.738 to 2010-08-27 12:06:09.728 on the new graph.

  • Answer:

    Assuming that the XML is in a file called graph.xml, you can use SimpleXML to extract the values like this: $xml = simplexml_load_file('graph.xml'); $range = array(); $i = 0; foreach ($xml->set as $set) { if ($set['name'] >= "2010-08-27 12:05:03.738" && $set['name'] <= "2010-08-27 12:06:09.728") { $range[$i]['name'] = (string) $set['name']; $range[$i]['value'] = (string) $set['value']; $range[$i]['hoverText'] = (string) $set['hoverText']; $i++; } }

David Powers at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.