[mapguide-users] Modify mapdefinition in a layout

euskalmap ziburudebian at free.fr
Thu Mar 26 11:44:13 EDT 2009


Hi alucas,
you have very luck because it seems that i have problem in my C# code or perhaps in my configuration of mapguide server.




Hi
I provide the end user with a link to my special page (see the code1). In that page i redirect to the MapGuide viewer files (Response.Redirect).
code1:

The fonction SetLayout Map modify the mapdefinition in my layout. See image here :

The problem : the layout is not modify and i have this message : An exception occurred in the XML parser.
Have you an idea ?
Thanks





Hello,

this code works well for me (PHP):

function changeWebLayout($rs, $WebLayoutResId, $newMapResId, $s)
  { 
	     try
	     {
	     	 // Obtenemos el contenido del WebLayout en XML
		     $byteReader = $rs->GetResourceContent($WebLayoutResId);
		     $xml = $byteReader->ToString();
		     $doc = DOMDocument::loadXML($xml);
		     
		     // Accedemos al nodo que queremos
		     $wl = $doc->getElementsByTagName("ResourceId"); 
		     $mapResIdNode = $wl->item(0);
		     
		     $mapResIdNode->nodeValue = $newMapResId->ToString();
		     
		     $strXML = $doc->saveXML();
				 //header('content-type: text/xml');
				 
		     $byteSource = new MgByteSource($strXML, strlen($strXML));
		     $byteSource->SetMimeType(MgMimeType::Xml);
		     
		     // Modificamos el repositorio
		     $rs->SetResource($WebLayoutResId, $byteSource->GetReader(), null);
		     
	    }
	    catch (MgException $e)
	    {
	    	echo $e->GetDetails();
	    }



-- 
View this message in context: http://n2.nabble.com/Modify-mapdefinition-in-a-layout-tp2462320p2539187.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list