[Solved] "Well-formed" ManiaCode question: install_map

Talk about ManiaLink development in this forum

Moderator: NADEO

Post Reply
User avatar
ChallengeSY
Posts: 62
Joined: 08 Nov 2012, 03:32
Location: United States ET

[Solved] "Well-formed" ManiaCode question: install_map

Post by ChallengeSY »

While adding functionality to my little map repository, I add in functionality to automatically download a map. Upon testing the download button, I receive this:
Error Report wrote: Cannot retrieve the Manialink:
ManiaCode script is not well-formed
Here is the XML file that is generated by the PHP script, as captured by Fiddler:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>

<maniacode>
<install_map>
  <url>https://sm.mania-exchange.com/maps/download/13937</url>
</install_map>
</maniacode>
While looking through various guides, I have seen conflicting sources as to whether the name tag inside install_map is required or not. Which source is most accurate? Is there anything else I might be missing?
Last edited by ChallengeSY on 09 Apr 2017, 01:28, edited 2 times in total.
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: "Well-formed" ManiaCode question(s)

Post by undef.de »

You should replace the common entities in the URL (even if they are not included in your example yet):

Code: Select all

	public function encodeEntities ($string) {
		return str_replace(
				array(
					'&',
					'"',
					"'",
					'>',
					'<',
				),
				array(
					'&amp;',
					'&quot;',
					'&apos;',
					'&gt;',
					'&lt;',
				),
				$string
		);
	}
Taken from my UASECO helper.class.

That's the only thing that i can imagine right now.
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
User avatar
ChallengeSY
Posts: 62
Joined: 08 Nov 2012, 03:32
Location: United States ET

Re: "Well-formed" ManiaCode question(s)

Post by ChallengeSY »

It will definitely help later on, but I still wonder how this ManiaCode managed to fail the well-formed test, when XML validators by W3Schools and W3C report zero errors. It is one thing if it is not well formed, but it is a different matter if it is well formed, but invalid.

On a somewhat related note, the safety mechanism works fine if someone tries to execute the codename without having a map ID in session memory. No errors are triggered, and the message is properly shown.

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>

<maniacode>
<show_message>
  <message>No map ID was successfully supplied</message>
</show_message>
</maniacode>
Last edited by ChallengeSY on 08 Apr 2017, 17:14, edited 1 time in total.
zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: "Well-formed" ManiaCode question(s)

Post by zocka »

Based on the maniaplanet wiki regarding maniacodes, the implementation in Nadeo's manialib and the implementation in steeffeen's FML I would say that the name is required.
I think the name part was displayed in the dialog as "downloading <name>".

As far as I know nothing much changed for maniacodes in the last years, so I usually look up that wiki link, but I haven't used maniacodes for quite some years.
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka
User avatar
ChallengeSY
Posts: 62
Joined: 08 Nov 2012, 03:32
Location: United States ET

Re: "Well-formed" ManiaCode question(s)

Post by ChallengeSY »

Now, it makes sense. The name tag is required, otherwise the XML file is invalid. Fortunately, the file name and map name are preserved even if I have to deviate from the them. In fact, it looks pretty good testing out the downloads.

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>

<maniacode>
<install_map>
  <name>Gentle Terrace</name>
  <url>https://sm.mania-exchange.com/maps/download/13937</url>
</install_map>
</maniacode>
Post Reply

Return to “ManiaLink”

Who is online

Users browsing this forum: No registered users and 3 guests