Jump to content

PHP XML error when reading "&" symbol


proggie7

Recommended Posts

Hi!

 

data.xml

<?xml version="1.0" encoding="utf-8" ?>
<data>
<menu>
<item link="http://site.com/?param=1&param=2">Title</item>
</menu>
</data>

 

xmp_reader.php

  
<?php
$doc = new DOMDocument();
$doc->load( 'data.xml' );
?>

 

Error

Warning: DOMDocument::load() [domdocument.load]: EntityRef: expecting ';' in file:///C:/Server/local.com/www/data.xml, line: 4 in C:/Server/local.com/www\xml_reader.php on line 3

 

 

I can see that "&" symbol is causing all the trouble. What can I do about it? Can I shield it, for example?

Link to comment
https://forums.phpfreaks.com/topic/192997-php-xml-error-when-reading-symbol/
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.