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
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.