Drezard Posted April 7, 2007 Share Posted April 7, 2007 Okay, heres the errors: Warning: simplexml_load_file() [function.simplexml-load-file]: core/combat/magic/Spark.const.xml:4: parser error : Extra content at the end of the document in C:\Program Files\xampp\htdocs\wintersword\core\combat\combat.class.php on line 481 Warning: simplexml_load_file() [function.simplexml-load-file]: <mastery>Death</mastery> in C:\Program Files\xampp\htdocs\wintersword\core\combat\combat.class.php on line 481 Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in C:\Program Files\xampp\htdocs\wintersword\core\combat\combat.class.php on line 481 and heres the .xml document: <?xml version="1.0" ?> <name>Spark</name> <mastery>Death</mastery> <damage>25</damage> <cost>500</cost> <class>Mage</class> <constreq>Intelligence</constreq> <reqnumber>20</reqnumber> Do i need to post the script aswell? Here are the lines that use XML in the script: $query = "SELECT magic FROM user_magic WHERE id='$id'"; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { echo "<table border=1 width='100%'>"; while(list($magic) = mysql_fetch_row($result)) { $file = "core/combat/magic/".$magic.".const.xml"; $xml_magic = simplexml_load_file($file); $damage = $xml_magic->damage; $mastery = $xml_magic->mastery; $cost = $xml_magic->cost; echo "<tr>"; echo "<td>$magic</td>"; echo "<td>$mastery</td>"; echo "<td>$damage</td>"; echo "<td>$cost</td>"; echo "<td><a href='combat_deletemagic.php?skill=$magic'>Delete Magic</a> </td>"; echo "</tr>"; } echo "</table>"; } What have i done wrong? - Cheers, Daniel Quote Link to comment Share on other sites More sharing options...
per1os Posted April 7, 2007 Share Posted April 7, 2007 Try this for the xml document <?xml version="1.0" ?> <resultset> <name>Spark</name> <mastery>Death</mastery> <damage>25</damage> <cost>500</cost> <class>Mage</class> <constreq>Intelligence</constreq> <reqnumber>20</reqnumber> </resultset> See if that helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.