Report any technical problems you discover and discuss solutions.

Upgrading from Xerte v1 to v2.0 - problem with pre

  • Kalle
  • Onderwerp Auteur
  • Offline
  • Nieuw lid
  • Nieuw lid
Meer
12 jaren 9 maanden geleden - 12 jaren 8 maanden geleden #920 door Kalle
Dear all,

I am upgrading from Xerte v1 to Xerte v2 and have run into viewing problems with some learning objects created in v1. I have tracked down the problem to the ampersand character in the preview.xml. I think v1 did not encode ampersand properly as it is stored as a plain character whilst other special characters are encoded with html encoding. The preview fails if the learning object contains an ampersand. I have searched the forums and internet without finding any answers.

Has anyone experienced the same problem?

The way preview.xml is handled seems to have changed between v.1 and v.2.
Version 2 uses the SimpleXml_from_string() function.


I have tracked it down to the file /website_code/php/xmlInspector.php.
Around line 130, we have the call:
$this->xml = simplexml_load_string($xml);

This call fails if the text contains an ampersand ("&").
I have a fix for it though….

This is how to replicate the problem:
1. Create a learning object in v1.
2. Include an hotspot item . Make sure the hotspot has a "&" in it.
Example:

<hotspot name="Videos & podcasts" text=" There are loads of free videos and podcasts available to download online." x="560.4703125" y="335.7203125" w="192.652890625" h="95.729453125" />

3. Save it.
4. Copy the USER-FILES folder and import the database to v.2.
5. Try to preview the learning object in v.2. This should result in an HTTP Error 500


These are my server details:

Windows Server 2008
Apache 2.2
PHP 5.2.10
MySQL Ver 14.14 Distrib 5.1.38, for Win64 (unknown)
Xerte 2.0 (svn r1087)
Laatst bewerkt 12 jaren 8 maanden geleden door Kalle.

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
12 jaren 9 maanden geleden #921 door tom
Yes, this is a known issue and the code should have handled it. I'm not at my desk right now, but I'll check it tonight. I'll let you know where this is supposed to be handled.

Tom

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
12 jaren 9 maanden geleden #923 door tom
Hi,

The $this->xml = simplexml_load_string($xml); line is at line 139 in my version, and just above it is the code that tries to fix this issue, starting at line 125.

If you don't have this in your code, could you try to pickup the latest 2.0 (or 2.1-beta) from this site (from resources->Downloads)

If you have this code, it doesn't solve your particular issue, would you mind setting $development to true in config.php (line 26 ) and make sure the debug log file (defined on line 33) is at a location the webserver has write permissions, and send the contents of the log to me, or post it here?

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

  • Kalle
  • Onderwerp Auteur
  • Offline
  • Nieuw lid
  • Nieuw lid
Meer
12 jaren 8 maanden geleden - 12 jaren 8 maanden geleden #933 door Kalle
If have tried both v2.0 and 2.1beta but the Edit, Preview, Delete, Duplicate buttons etc in My Projects are disabled. I have cleared my Firefox cache as suggested here

www.xerte.org.uk/index.php?option=com_ku...temid=759&lang=en#41

without luck. Any ideas of how to get them enabled?

Edit
The reason why the buttons were disabled was that I forgot to change the site_url.
To fix it, run
Code:
SELECT * FROM xerte.xt_sitedetails;

and make sure that the
Code:
site_url
has the correct value.
Laatst bewerkt 12 jaren 8 maanden geleden door Kalle.

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

  • Kalle
  • Onderwerp Auteur
  • Offline
  • Nieuw lid
  • Nieuw lid
Meer
12 jaren 8 maanden geleden - 12 jaren 8 maanden geleden #992 door Kalle
I've updated to Xerte version 2.1 (git git-82-g70282af).

I've have these lines which I assume is the fix:
Code:
if (!$this->isValidXml($xml)) { // Try and fix it ? _debug("Invalid XML found; trying to repair"); $ok = $this->fixXmlFile($name); if ($ok === false) { // Could not fix it! _debug("Could not fix up the xml file with $name; consult error logs etc."); } else { // reload. $xml = file_get_contents($name); } } $this->xml = simplexml_load_string($xml);

I do a
Code:
var_dump($this->xml);
after the fix and this returns
Code:
bool(false)
.
The output of
Code:
libxml_get_errors();
Code:
array(4) { [0]=> object(LibXMLError)#8 (6) { ["level"]=> int(3) ["code"]=> int(68) ["column"]=> int(2321) ["message"]=> string(27) "xmlParseEntityRef: no name " ["file"]=> string(0) "" ["line"]=> int(1) } [1]=> object(LibXMLError)#20 (6) { ["level"]=> int(3) ["code"]=> int(68) ["column"]=> int(3381) ["message"]=> string(27) "xmlParseEntityRef: no name " ["file"]=> string(0) "" ["line"]=> int(1) } [2]=> object(LibXMLError)#19 (6) { ["level"]=> int(3) ["code"]=> int(68) ["column"]=> int(2321) ["message"]=> string(27) "xmlParseEntityRef: no name " ["file"]=> string(0) "" ["line"]=> int(1) } [3]=> object(LibXMLError)#18 (6) { ["level"]=> int(3) ["code"]=> int(68) ["column"]=> int(3381) ["message"]=> string(27) "xmlParseEntityRef: no name " ["file"]=> string(0) "" ["line"]=> int(1) } }


This is the output of the debug.log file which I have anonymised:
Code:
2013-12-02 16:42:37 \website_code\php\xmlInspector.php111Trying to simplexml_load_file : USER-FILES/357-staff-Nottingham/preview.xml 2013-12-02 16:42:37 \website_code\php\xmlInspector.php95Error detected in XML : : line 1, col:2321, message:xmlParseEntityRef: no name , : line 1, col:3381, message:xmlParseEntityRef: no name 2013-12-02 16:42:37 \website_code\php\xmlInspector.php132Invalid XML found; trying to repair 2013-12-02 16:42:37 \xerte\website_code\php\xmlInspector.php51We were able to fixup the file : USER-FILES/357-staff-Nottingham/preview.xml

Any suggestions?
Laatst bewerkt 12 jaren 8 maanden geleden door Kalle.

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
12 jaren 8 maanden geleden #994 door tom
Could you send me the file USER-FILES/357-staff-Nottingham/preview.xml
(There seems to be an issue at position 2321 and at position 3381 in that file)

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Moderators: ronmjultenJohnSmith
Tijd voor maken pagina: 0.200 seconden
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo