Jump to content

XML errors


Drezard

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/45959-xml-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.