Reputation: 63718
I am trying to use XML in a PHP document. I am getting an error for the <?xml
and the ?>
tags. I assume PHP is trying to read the XML tags as PHP tags. Does anyone know what bug is?
<body>
<?xml-stylesheet type="text/css" href="stylebox.css" ?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect id="p1" x="100" y="100" width="100" height="100" />
<rect id="p2" x="200" y="100" width="100" height="100" />
</svg>
</body>
Upvotes: 3
Views: 192
Reputation:
This is short php open tags creating problem. Change settings in you php.ini file
Put :
short_open_tag = Off
Otherwise assign this value in a variable in place of
<?xml-stylesheet type="text/css" href="stylebox.css" ?>
:
$XMLstr='<?xml-stylesheet type="text/css" href="stylebox.css" ?>';
echo $XMLstr;
Upvotes: 2
Reputation: 4346
PHP is trying to parse your <? ?>
tags as short opening and closing PHP tags.
Try printing this using echo
, print
, etc.:
<body>
<?php echo '<?xml-stylesheet type="text/css" href="stylebox.css" ?>'; ?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect id="p1" x="100" y="100" width="100" height="100" />
<rect id="p2" x="200" y="100" width="100" height="100" />
</svg>
</body>
Upvotes: 1