XML > XLST > PHP / Warning: Sablotron error on line 117: XML parser error 3
Bonjour
j'ai un petit soucis ...
je m'explique:
je reçois un flux XML que j'affiche dans ma page php
souvent ça marche mais des fois j'ai :
Code:
Warning: Sablotron error on line 117: XML parser error 3: no element found in /home.2/sudguide/www/rencontre/index.php on line 47
l'URL en question est:ici
je met aussi le code
Exemple de XML
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <?xml version="1.0" encoding="UTF-8" ?>
- <profil>
- <item>
<id>2122494</id>
<login>lasciamifare</login>
<sexe>Un homme</sexe>
<age>53</age>
<yeux>Marron</yeux>
<cheveux>Chauve</cheveux>
<pays>Italia</pays>
<region>Lazio</region>
<departement />
<nom_departement>Roma</nom_departement>
<ville>Roma</ville>
<description>Sono qui per conoscere persone simpatiche e trasgressive: vorrei conoscere una donna decisa e determinata con cui condividere piacevoli momenti senza crearci troppe paranoie per il futuro... Sono serio ma non serioso, molto discreto ed affidabile...e so esser molto dolce e passionale</description>
<webcam>yes</webcam>
<photo>/pixs0/l/a/lasciamifare.jpg</photo>
</item>
- </profil> |
Mon code XSL
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "*">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "">
<!ENTITY mdash "">
<!ENTITY ldquo "">
<!ENTITY rdquo "">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>test xml</title>
<link href="/sudguide.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center"><br/>
<xsl:for-each select="profil/item">
<table bgcolor='#F4CBDF' cellspacing='0' width='600' style='border:1px solid #993366;border-collapse:collapse;'>
<tr>
<td width="70" align="center" valign="middle"><span class="bloc"><a href="http://sud-guide.love.easyrencontre.com/u_page.php?id={id}" target="_blank"><img src="http://sud-guide.love.easyrencontre.com/{photo}" alt="{login}" style='border:1px solid #993366;' /></a></span></td>
<td width="524" colspan="2" valign="top" class="Vert11BLEU" align="left"><p><b><xsl:value-of select="login"/></b>
<xsl:if test='sexe="Un homme"'>
<img src="/images/masc.gif" alt="Un homme" />
</xsl:if>
<xsl:if test='sexe="Une femme"'>
<img src="/images/femi.gif" alt="Une femme" />
</xsl:if>
<span class="Vert10BLEU"><xsl:value-of select="age"/> ans</span></p>
<p align="justify" style="margin-right:5px"><xsl:value-of select="description"/></p>
<p>[<u>Localisation</u> : <span class="Vert10BLEU"><xsl:value-of select="pays"/></span> > <span class="Vert10BLEU"><xsl:value-of select="region"/></span> > <span class="Vert10BLEU"><xsl:value-of select="nom_departement"/></span> <span class="Vert10BLEU"><xsl:value-of select="departement"/></span> > <xsl:value-of select="ville"/>]</p></td>
</tr>
</table>
<br />
</xsl:for-each>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet> |
Et pour finir le PHP
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <?php
$xh = xslt_create();
$file=fopen("http://sud-guide.love.easyrencontre.com/flux/XML.php?age_min=15&ville=$ville","r");
$xml=fread($file,16384);
fclose($file);
$file=fopen("lecture.xsl","r");
$xsl=fread($file,16384);
fclose($file);
$arguments = array(
'/_xml' => $xml,
'/_xsl' => $xsl
);
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
xslt_free($xh);
print "$result";
?> |
L'erreur se situe a la ligne 47 de ma page PHP soit
Code:
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
Si quelqu'un sait ..... merci d'avance