<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2800.1505" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Comic Sans MS">
<DIV>Tamas,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm wondering about the real need for XML version of MapFiles as well.&nbsp;&nbsp; Before going to town with this I think I need to plpay around with some alternatives to see what might/might not work for our needs, which is basically to build a GUI editor for Cartography, and another future item, is to be able to manage many layers in an abstracted mode.&nbsp; We use sepearte MapFiles now for each layer in GeoMoose for example.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I've looked at some of the editors, but they don't entirely come up to snuff and seem hard to keep inline with development.</DIV>
<DIV>&nbsp;</DIV>
<DIV>My first thought was to use Shell scripting to do the XML writing.&nbsp; But I agree with your thought about not all issues are being taken into account.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I wonder if it makes sense to try and limit the scope of the XML definitions, maybe a subset of the params in the LAYER block or some such.&nbsp; Still pondering . . . .</DIV>
<DIV>bobb</DIV>
<DIV><BR><BR>&gt;&gt;&gt; "Tamas Szekeres" &lt;szekerest@gmail.com&gt; wrote:<BR></DIV>
<DIV style="PADDING-LEFT: 7px; MARGIN: 0px 0px 0px 15px; BORDER-LEFT: #050505 1px solid; BACKGROUND-COLOR: #f3f3f3">Bob,<BR><BR>Here`s a demo example to show what the XML writer would do:<BR><BR>typedef struct object_info {<BR>char* name;&nbsp; // may be the corresponding mapfile item name<BR>void* value;&nbsp;&nbsp; // reference to the object or value (string)<BR>char* type;&nbsp;&nbsp; // type of the item<BR>bool isValueType;<BR>int index;<BR>} objectInfo;<BR><BR>int WriteObjectAsXML(objectInfo i, msIOContext *context)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char buffer[1024];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objectInfo s;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (i.isValueType)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp; sprintf(buffer, "&lt;%s type=%s&gt;%s&lt;/%s&gt;", i.name, i.type,<BR>(char*)i.value, i.name);<BR>&nbsp;&nbsp; msIO_contextWrite(context, buffer, strlen(buffer));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf(buffer, "&lt;%s type=%s&gt;", i.name, i.type);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msIO_contextWrite(context, buffer, strlen(buffer));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (s = GetNextSubItem(i))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriteObjectAsXML(s, context);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf(buffer, "&lt;/%s&gt;", i.name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msIO_contextWrite(context, buffer, strlen(buffer));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>}<BR><BR>int WriteMapAsXML(mapObj map, msIOContext *context)<BR>{<BR>&nbsp;&nbsp;&nbsp; objectInfo i, s;<BR>&nbsp;&nbsp;&nbsp; i.name = "MAP"<BR>&nbsp;&nbsp;&nbsp; i.value = map;<BR>&nbsp;&nbsp;&nbsp; i.type = "mapObj";<BR>&nbsp;&nbsp;&nbsp; WriteObjectAsXML(i, context);<BR>}<BR><BR>However I don`t think that all of the possible issues have been taken<BR>into account. Just for something to think about.<BR><BR>Best regards,<BR><BR>Tamas<BR><BR><BR><BR>2008/6/11 Bob Basques &lt;Bob.Basques@ci.stpaul.mn.us&gt;:<BR>&gt; Tamas,<BR>&gt;<BR>&gt; I know this would be easier to add after an XML conversion process were<BR>&gt; arrived at, but it's going further than what I was intending, at least in<BR>&gt; the near term.<BR>&gt;<BR>&gt; It does get me thinking about things in more detail though, how would your<BR>&gt; ideas translate into the XML itself, I mean would there be things that would<BR>&gt; be bad to use in the XML that might mitigate these ideas?<BR>&gt;<BR>&gt; I subscribed to the DEV list, but no Email confirmation yet.<BR>&gt;<BR>&gt; bobb<BR>&gt;<BR>&gt;&gt;&gt;&gt; "Tamas Szekeres" &lt;szekerest@gmail.com&gt; wrote:<BR>&gt; Hi Bob and All,<BR>&gt;<BR>&gt; I would support having an interface in mapserver that would provide<BR>&gt; low level access to the object hierarchy, like:<BR>&gt;<BR>&gt; typedef struct object_info {<BR>&gt;&nbsp;&nbsp; char* name;<BR>&gt;&nbsp;&nbsp; void* value;<BR>&gt;&nbsp;&nbsp; char* type;<BR>&gt;&nbsp;&nbsp; int index;<BR>&gt; } objectInfo;<BR>&gt;<BR>&gt; objectInfo* GetNextSubItem(objectInfo* object);<BR>&gt;<BR>&gt; By using this, each persistence provider (MapFile/XML/JSON) could go<BR>&gt; through the object hierarchy easily<BR>&gt; In order to support reading the files, the mapObj properties in the<BR>&gt; hierarchy could also be set in an unique manner, like:<BR>&gt;<BR>&gt; int AddSubItem(objectInfo parent, objectInfo child);<BR>&gt;<BR>&gt; We should also utilize an msIO like functionality so that the<BR>&gt; providers would support reading from and writing to various kind of<BR>&gt; streams/storage types.<BR>&gt;<BR>&gt; We should probably switch to the -dev list with further implementation<BR>&gt; details.<BR>&gt;<BR>&gt; Best regards,<BR>&gt;<BR>&gt; Tamas<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; 2008/6/10 Bob Basques &lt;Bob.Basques@ci.stpaul.mn.us&gt;:<BR>&gt;&gt; All,<BR>&gt;&gt;<BR>&gt;&gt; We've been pondering some sort of alternative to the Mapfiles for a few<BR>&gt;&gt; years now.&nbsp; A preferable approach would be something that could be stored<BR>&gt;&gt; in<BR>&gt;&gt; a DB in some fashion for querying/assembly processes.&nbsp; It seems on the<BR>&gt;&gt; surface like a DB schema could be developed to handle the MapFile storage<BR>&gt;&gt; aspects.<BR>&gt;&gt;<BR>&gt;&gt; A first step would be in how to best approach moving into an XML way of<BR>&gt;&gt; life<BR>&gt;&gt; for the MapFiles.&nbsp; Would it make any sense in the beginning to just build<BR>&gt;&gt; a<BR>&gt;&gt; MapFile2XML convertor (I would imagine this would be needed before anyone<BR>&gt;&gt; would sign up for XML) and once something like this is a state close to<BR>&gt;&gt; production, the innards of MapServer would then be made to parse the XML<BR>&gt;&gt; directly?<BR>&gt;&gt;<BR>&gt;&gt; Another approach might be to do something like MapFile2SQL first, and then<BR>&gt;&gt; the MapFile2XML.&nbsp; This might save some time and seem like it would make<BR>&gt;&gt; standardization easier, since it would need to be inside of the DB fist.<BR>&gt;&gt;<BR>&gt;&gt; Has anyone tried putting together any requirements list along these lines<BR>&gt;&gt; at<BR>&gt;&gt; all?&nbsp; Is it going to be something where we just need to jump in and build<BR>&gt;&gt; something even if it might be a wrong approach to begin with?<BR>&gt;&gt;<BR>&gt;&gt; This thread just got me thinking is all . . .you know how dangerous that<BR>&gt;&gt; can<BR>&gt;&gt; be . . . :c)<BR>&gt;&gt;<BR>&gt;&gt; bobb<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt; "Tamas Szekeres" &lt;szekerest@gmail.com&gt; wrote:<BR>&gt;&gt; Hi,<BR>&gt;&gt;<BR>&gt;&gt; MapServer currently doesn`t support any other persitence<BR>&gt;&gt; representation than the mapfiles. There have been some initial plans<BR>&gt;&gt; related to an XML format in this list, but no one had any motivation<BR>&gt;&gt; to implement that.<BR>&gt;&gt; So I think the best what you can do at the moment is to use reflection<BR>&gt;&gt; to access the properties along with some other members of the objects<BR>&gt;&gt; and serialize the values manually.<BR>&gt;&gt;<BR>&gt;&gt; Best regards,<BR>&gt;&gt;<BR>&gt;&gt; Tamas<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; 2008/6/9 BrainDrain &lt;paulborodaev@gmail.com&gt;:<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; Is there any 'standart' fast(!) way/method to serialize (xml/json/other<BR>&gt;&gt;&gt; markup) mapObj in C#? I need it for using server mapObj as JSON on rich<BR>&gt;&gt;&gt; client app running on browser. Look at my method (using reflection):<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; public static ListDictionary PartialSerialize(object instance, Stack<BR>&gt;&gt;&gt; callerTypes, Type[] excludeTypes)<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ListDictionary result = new ListDictionary();<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object val;<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callerTypes.Push(instance.GetType());<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PropertyInfo[] pis = instance.GetType().GetProperties();<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (PropertyInfo pi in pis)<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (pi.PropertyType.IsSerializable &amp;&amp;<BR>&gt;&gt;&gt; !pi.PropertyType.IsArray)<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result[pi.Name] = pi.GetValue(instance, new<BR>&gt;&gt;&gt; object[0]);<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //preventing useless nesting<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!callerTypes.Contains(pi.PropertyType) &amp;&amp;<BR>&gt;&gt;&gt; !((IList)excludeTypes).Contains(pi.PropertyType))<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return result;<BR>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt;&gt;&gt; ...<BR>&gt;&gt;&gt; So I can convert mapObj on serever to hashtable automatically an then<BR>&gt;&gt;&gt; populate JSON object<BR>&gt;&gt;&gt; (still need to call explicitly getLayer, getClass etc., but this is not a<BR>&gt;&gt;&gt; problem):<BR>&gt;&gt;&gt; ...<BR>&gt;&gt;&gt; layers[i].Properties = Tools.PartialSerialize(layer, new Stack(), new<BR>&gt;&gt;&gt; Type[3] { typeof(mapObj), typeof(hashTableObj), typeof(colorObj)});<BR>&gt;&gt;&gt; ...<BR>&gt;&gt;&gt; classes[j].Properties = Tools.PartialSerialize(layerClass, new Stack(),<BR>&gt;&gt;&gt; new<BR>&gt;&gt;&gt; Type[4] { typeof(layerObj), typeof(labelObj), typeof(hashTableObj),<BR>&gt;&gt;&gt; typeof(colorObj)});<BR>&gt;&gt;&gt; ...<BR>&gt;&gt;&gt; styles[k].Properties = Tools.PartialSerialize(classStyle, new Stack(),<BR>&gt;&gt;&gt; new<BR>&gt;&gt;&gt; Type[2]{typeof(hashTableObj), typeof(colorObj)});<BR>&gt;&gt;&gt; ...<BR>&gt;&gt;&gt; mapStub.Properties = Tools.PartialSerialize(map, new Stack(), new<BR>&gt;&gt;&gt; Type[11]<BR>&gt;&gt;&gt; {<BR>&gt;&gt;&gt; typeof(labelObj), typeof(hashTableObj), typeof(fontSetObj),<BR>&gt;&gt;&gt; typeof(labelCacheObj), typeof(outputFormatObj[]), typeof(queryMapObj),<BR>&gt;&gt;&gt; typeof(referenceMapObj), typeof(scalebarObj), typeof(symbolSetObj),<BR>&gt;&gt;&gt; typeof(colorObj), typeof(legendObj)});<BR>&gt;&gt;&gt; ...<BR>&gt;&gt;&gt; JavaScriptSerializer class object allows to perform convertion to client<BR>&gt;&gt;&gt; More often I use script method in my web service that can do it behind<BR>&gt;&gt;&gt; the<BR>&gt;&gt;&gt; scenes.<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; How do you do such kind of operation?<BR>&gt;&gt;&gt; --<BR>&gt;&gt;&gt; View this message in context:<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; <A href="http://www.nabble.com/mapObject">http://www.nabble.com/mapObject</A>-serialization-in-C--(variant)-tp17739919p17739919.html<BR>&gt;&gt;&gt; Sent from the Mapserver - User mailing list archive at Nabble.com.<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; _______________________________________________<BR>&gt;&gt;&gt; mapserver-users mailing list<BR>&gt;&gt;&gt; mapserver-users@lists.osgeo.org<BR>&gt;&gt;&gt; <A href="http://lists.osgeo.org/mailman/listinfo/mapserver">http://lists.osgeo.org/mailman/listinfo/mapserver</A>-users<BR>&gt;&gt;&gt;<BR>&gt;&gt; _______________________________________________<BR>&gt;&gt; mapserver-users mailing list<BR>&gt;&gt; mapserver-users@lists.osgeo.org<BR>&gt;&gt; <A href="http://lists.osgeo.org/mailman/listinfo/mapserver">http://lists.osgeo.org/mailman/listinfo/mapserver</A>-users<BR>&gt;&gt;<BR>&gt;&gt; _______________________________________________<BR>&gt;&gt; mapserver-users mailing list<BR>&gt;&gt; mapserver-users@lists.osgeo.org<BR>&gt;&gt; <A href="http://lists.osgeo.org/mailman/listinfo/mapserver">http://lists.osgeo.org/mailman/listinfo/mapserver</A>-users<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt; _______________________________________________<BR>&gt; mapserver-users mailing list<BR>&gt; mapserver-users@lists.osgeo.org<BR>&gt; <A href="http://lists.osgeo.org/mailman/listinfo/mapserver">http://lists.osgeo.org/mailman/listinfo/mapserver</A>-users<BR>&gt;<BR></DIV></BODY></HTML>