<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I can safely say that working with JSONIX has been a pleasure for me up until now, with great help from Aleksei. I’ve used it for all WPS formats (GetCapabilities, DescribeProcess and Execute).<div><br></div><div>No need for re-inventing the wheel with owslib.js, at least with my 2 cents.<br><div><br></div><div>Best regards,</div><div>Bart</div><div><br></div><div><div><div>On 17 Aug 2014, at 20:30, Aleksei Valikov <<a href="mailto:valikov@gmx.net">valikov@gmx.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi everyone,<div><br></div><div>I'd like to introduce my open-source JS library, Jsonix (<a href="https://github.com/highsource/jsonix">https://github.com/highsource/jsonix</a>) which - in my opinion suits very well for OWS needs.</div>
<div><br></div><div>Jsonix stands for "JSON interfaces for XML" and allows converting between JSON and XML in certain schema with no pain.</div><div>Here's a small code example to demonstrate what it looks like:</div>
<div><br></div><div><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;padding:16px;line-height:1.45;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;word-break:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><span class="" style="color:rgb(153,153,136);font-style:italic">// First we construct a Jsonix context - a factory for unmarshaller (parser)</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// and marshaller (serializer)</span>
<span class="" style="font-weight:bold">var</span> <span class="">context</span> <span class="" style="font-weight:bold">=</span> <span class="" style="font-weight:bold">new</span> <span class="">Jsonix</span><span class="">.</span><span class="">Context</span><span class="">([</span><span class="">PO</span><span class="">]);</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// Then we create a unmarshaller</span>
<span class="" style="font-weight:bold">var</span> <span class="">unmarshaller</span> <span class="" style="font-weight:bold">=</span> <span class="">context</span><span class="">.</span><span class="">createUnmarshaller</span><span class="">();</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// Unmarshal an object from the XML retrieved from the URL</span>
<span class="">unmarshaller</span><span class="">.</span><span class="">unmarshalURL</span><span class="">(</span><span class="" style="color:rgb(221,17,68)">'po.xml'</span><span class="">,</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// This callback function will be provided</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// with the result of the unmarshalling</span>
<span class="" style="font-weight:bold">function</span> <span class="">(</span><span class="">unmarshalled</span><span class="">)</span> <span class="">{</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// Alice Smith</span>
<span class="">console</span><span class="">.</span><span class="">log</span><span class="">(</span><span class="">unmarshalled</span><span class="">.</span><span class="">value</span><span class="">.</span><span class="">shipTo</span><span class="">.</span><span class="">name</span><span class="">);</span>
<span class="" style="color:rgb(153,153,136);font-style:italic">// Baby Monitor</span>
<span class="">console</span><span class="">.</span><span class="">log</span><span class="">(</span><span class="">unmarshalled</span><span class="">.</span><span class="">value</span><span class="">.</span><span class="">items</span><span class="">.</span><span class="">item</span><span class="">[</span><span class="" style="color:rgb(0,153,153)">1</span><span class="">].</span><span class="">productName</span><span class="">);</span>
<span class="">});</span></pre></div><div><br></div><div>You can try it online in JSFiddle: <a href="http://jsfiddle.net/lexi/LP3DC/">http://jsfiddle.net/lexi/LP3DC/</a></div><div><br></div><div>Jsonix is schema-driven. You can basically take an XML Schema and compile it into JSON-XML mappings.</div>
<div>Jsonix will then be able to unmarshal XML into JSON which is very easy to process in JavaScript programs.</div><div>You can also marshal JSON into XML so you're getting the full XML<->JSON rountrip for free.</div>
<div><br></div><div>Java developers out there will defintely recognize similarities to JAXB. Jsonix is basically a JAXB analog for JavaScript.</div><div><br></div><div>I wrote Jsonix with OGC Schemas in mind.</div><div>Here's a WMS demo: <a href="https://github.com/highsource/jsonix/tree/master/demos/wms">https://github.com/highsource/jsonix/tree/master/demos/wms</a></div>
<div>Here's a sample WPS project: <a href="https://github.com/highsource/jsonix/tree/master/nodejs/tests/wps">https://github.com/highsource/jsonix/tree/master/nodejs/tests/wps</a></div><div><br></div><div>So if you need a reliable, schema-driven, strongly-typed and structured XML-JSON conversion for you target OGC spec, you can take Jsonix, compile your schema and save all those gory XML-to-JSON-and-back details, just concentrate on your payload in a neat predictable JSON form.</div>
<div><br></div><div>Jsonix works in most browsers (browser protability is ~ OpenLayers).</div><div>Works with node.js. Works with RequireJS. No conflicts with OpenLayers.</div><div>Open-source (3-clause BSD), no strings attached.</div>
<div>Heavily tested.</div><div><br></div><div>I'd be very glad if you consider using Jsonix for OWS. I'd be happy to provide support and help as much as I can.</div><div><br></div><div>Best wishes,</div><div>Alexey Valikov</div>
</div>
_______________________________________________<br>owslibjs mailing list<br><a href="mailto:owslibjs@lists.osgeo.org">owslibjs@lists.osgeo.org</a><br>http://lists.osgeo.org/cgi-bin/mailman/listinfo/owslibjs<br></blockquote></div><br></div></div></body></html>