[fusion-users] Newbie question: problem parsing Application
Definition
Richard Turner
richardt at mediatel.co.uk
Fri Sep 30 05:43:18 EDT 2011
Hi,
I've just started trying to set-up a sample application using Fusion and
MapServer, following the tutorial on the project wiki[1]. The page loads
OK (kinda - it complains about being unable to find jxskin-graphic.css,
which is indeed missing from the Fusion package), but displays no map
and throws a load of JavaScript errors.
Digging into the JS I see that ApplicationDefinition::parseAddDef()
attempts to get the MapGroup out of the JSON definition like so:
var mapSet = appDef.MapSet[0];
if (mapSet.MapGroup instanceof Array) {
for (var i=0; i<mapSet.MapGroup.length; i++) {
var mapGroup = new
Fusion.Lib.ApplicationDefinition.MapGroup(mapSet.MapGroup[i]);
this.mapGroups[mapGroup.mapId] = mapGroup;
}
}
However, mapSet.MapGroup is undefined. The relevant snippet from the
JSON returned by Xml2JSON.php is this (I've added white-space for clarity):
{
"MapSet":[[
{"@type":["MapSetType"]},
["x"],
{"MapGroup":[{
"@id":["mapserver"],
"@type":["MapType"],
"Map":[{
"@type":["MapLayerType"],
"Type":["MapServer"],
"SingleTile":["true"],
"Extension":[{"MapFile":["/path/to/gmap75.map"]}]
}]
}]}
]]
}
Now, that's some over-complex JSON - it looks to me that Xml2JSON.php
isn't quite doing it's job correctly.
To be honest, I'd prefer to write my configuration files in JSON than in
XML, so if there's an easy way to tell Fusion that's what I've done, and
have it request my JSON file from the server that would be my preferred
solution. It seems a bit wasteful to me to request XML from the server,
then send it back to be translated into JSON.
Anyway, doesn't anyone have any suggestions as to how I should proceed.
Obviously I want to avoid hacking Fusion files if I can - I don't want
to start maintaining my own patches.
Cheers,
R
More information about the fusion-users
mailing list