<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>All,</DIV>
<DIV>&nbsp;</DIV>
<DIV>We've been pondering some sort of alternative to the Mapfiles for a few years now.&nbsp; A preferable approach would be something that could be stored in a DB in some fashion for querying/assembly processes.&nbsp; It seems on the surface like a DB schema could be developed to handle the MapFile storage aspects.</DIV>
<DIV>&nbsp;</DIV>
<DIV>A first step would be in how to best approach moving into an XML way of life for the MapFiles.&nbsp; Would it make any sense in the beginning to just build a MapFile2XML convertor (I would imagine this would be needed before anyone would sign up for XML) and once something like this is a state close to production, the innards of MapServer would then be made to parse the XML directly?&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>Another approach might be to do something like MapFile2SQL first, and then the MapFile2XML.&nbsp; This might save some time and seem like it would make standardization easier, since it would need to be inside of the DB fist.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Has anyone tried putting together any requirements list along these lines at all?&nbsp; Is it going to be something where we just need to jump in and build something even if it might be a wrong approach to begin with?</DIV>
<DIV>&nbsp;</DIV>
<DIV>This thread just got me thinking is all . . .you know how dangerous that can be . . . :c)</DIV>
<DIV>&nbsp;</DIV>
<DIV>bobb</DIV>
<DIV>&nbsp;</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">Hi,<BR><BR>MapServer currently doesn`t support any other persitence<BR>representation than the mapfiles. There have been some initial plans<BR>related to an XML format in this list, but no one had any motivation<BR>to implement that.<BR>So I think the best what you can do at the moment is to use reflection<BR>to access the properties along with some other members of the objects<BR>and serialize the values manually.<BR><BR>Best regards,<BR><BR>Tamas<BR><BR><BR>2008/6/9 BrainDrain &lt;paulborodaev@gmail.com&gt;:<BR>&gt;<BR>&gt; Is there any 'standart' fast(!) way/method to serialize (xml/json/other<BR>&gt; markup) mapObj in C#? I need it for using server mapObj as JSON on rich<BR>&gt; client app running on browser. Look at my method (using reflection):<BR>&gt;<BR>&gt; public static ListDictionary PartialSerialize(object instance, Stack<BR>&gt; callerTypes, Type[] excludeTypes)<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ListDictionary result = new ListDictionary();<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object val;<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callerTypes.Push(instance.GetType());<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PropertyInfo[] pis = instance.GetType().GetProperties();<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (PropertyInfo pi in pis)<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (pi.PropertyType.IsSerializable &amp;&amp;<BR>&gt; !pi.PropertyType.IsArray)<BR>&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 object[0]);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&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;&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; !((IList)excludeTypes).Contains(pi.PropertyType))<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val = pi.GetValue(instance, new object[0]);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (val != null)<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result[pi.Name] = PartialSerialize(val,<BR>&gt; callerTypes, excludeTypes);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callerTypes.Pop();<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return result;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt; ...<BR>&gt; So I can convert mapObj on serever to hashtable automatically an then<BR>&gt; populate JSON object<BR>&gt; (still need to call explicitly getLayer, getClass etc., but this is not a<BR>&gt; problem):<BR>&gt; ...<BR>&gt; layers[i].Properties = Tools.PartialSerialize(layer, new Stack(), new<BR>&gt; Type[3] { typeof(mapObj), typeof(hashTableObj), typeof(colorObj)});<BR>&gt; ...<BR>&gt; classes[j].Properties = Tools.PartialSerialize(layerClass, new Stack(), new<BR>&gt; Type[4] { typeof(layerObj), typeof(labelObj), typeof(hashTableObj),<BR>&gt; typeof(colorObj)});<BR>&gt; ...<BR>&gt; styles[k].Properties = Tools.PartialSerialize(classStyle, new Stack(), new<BR>&gt; Type[2]{typeof(hashTableObj), typeof(colorObj)});<BR>&gt; ...<BR>&gt; mapStub.Properties = Tools.PartialSerialize(map, new Stack(), new Type[11] {<BR>&gt; typeof(labelObj), typeof(hashTableObj), typeof(fontSetObj),<BR>&gt; typeof(labelCacheObj), typeof(outputFormatObj[]), typeof(queryMapObj),<BR>&gt; typeof(referenceMapObj), typeof(scalebarObj), typeof(symbolSetObj),<BR>&gt; typeof(colorObj), typeof(legendObj)});<BR>&gt; ...<BR>&gt; JavaScriptSerializer class object allows to perform convertion to client<BR>&gt; More often I use script method in my web service that can do it behind the<BR>&gt; scenes.<BR>&gt;<BR>&gt; How do you do such kind of operation?<BR>&gt; --<BR>&gt; View this message in context: <A href="http://www.nabble.com/mapObject">http://www.nabble.com/mapObject</A>-serialization-in-C--(variant)-tp17739919p17739919.html<BR>&gt; Sent from the Mapserver - User mailing list archive at Nabble.com.<BR>&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>_______________________________________________<BR>mapserver-users mailing list<BR>mapserver-users@lists.osgeo.org<BR><A href="http://lists.osgeo.org/mailman/listinfo/mapserver">http://lists.osgeo.org/mailman/listinfo/mapserver</A>-users<BR></DIV></BODY></HTML>