[mapguide-users] Modify mapdefinition in a layout

alucas alucas at svl.es
Thu Mar 26 11:07:32 EDT 2009




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-tp2462320p2538960.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list