[mapguide-users] GetSelectionXML() how to read <Class id='Default:xxx'> in PHP.
Alain Lebatard
alain.lebatard at autodesk.com
Thu Nov 30 20:52:47 EST 2006
Hi Maciej,
Have you looked at the MgSelection class? It can parse the XML text
representing the selection and give you the list of layers that are part
of this selection.
The following code output the name of the selected layers
$sel = new MgSelection($map, $xmlSelText);
$layers = $sel->GetLayers();
for($i = 0; $i < $layers->GetCount(); $i++)
{
$layer = $layers->GetItem($i);
echo $layer->GetName() . "\n";
}
Alain
-----Original Message-----
From: Maciej Skorczewski [mailto:maciej.skorczewski at procad.pl]
Sent: Thursday, November 30, 2006 11:12 AM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] GetSelectionXML() how to read <Class
id='Default:xxx'> in PHP.
hi good people!
i work on 2 layer, all are selectable and visible on map, all object on
any of this 2 layer have a data (name,id, etc).
when user click on object it is selected , so i can get xml of this
selection...so i get it.
First selected object on layer "test" ganerate this XML
<?xml version="1.0" encoding="UTF-8"?>
<FeatureSet>
<Layer id="376274-234-234-234-23-4234">
<Class id="Default:test">
<ID>BQAAAA==</ID>
</Layer>
</FeatureSet>
First selected object on layer "test2" ganerate this XML
<?xml version="1.0" encoding="UTF-8"?>
<FeatureSet>
<Layer id="376274-234-234-234-23-4234">
<Class id="Default:test2">
<ID>BQAAAA==</ID>
</Layer>
</FeatureSet>
question is how can i get form this 2 xml , name of cliked layer
<Class id="Default:test"> --> layer: test
..i second
<Class id="Default:test2"> --> layer: test2
if have name of layer i can read (id,name , etc.)of selected
object.that is what i want.
is there any MG API solution? or i must use ex. SimpleXML to work whit
this xml.
...the best way mayby in future
$layer_name=$object->GetLayerName($xml_of_selected_object);
--
Maciej
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org
More information about the Mapguide-users
mailing list